From a4a3638913932b2d0bc0fc30b3baf3c4ad1fe7d5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 30 Dec 2025 19:08:33 +0000 Subject: [PATCH 1/2] Initial plan From 50564f730736291f7e5d0037b5fad1d3e6747af5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 30 Dec 2025 19:20:03 +0000 Subject: [PATCH 2/2] Refactor Button to use data-has-visuals instead of data-no-visuals - Change ButtonBase.tsx to set data-has-visuals when visuals exist (instead of data-no-visuals when they don't) - Update ButtonBase.module.css to use positive attribute check: - Replace [data-no-visuals='true'] with :not([data-has-visuals]) - Replace :not([data-no-visuals='true']) with [data-has-visuals] - Update test snapshots to reflect the new attribute behavior Co-authored-by: mattcosta7 <8616962+mattcosta7@users.noreply.github.com> --- packages/react/src/Button/ButtonBase.module.css | 10 +++++----- packages/react/src/Button/ButtonBase.tsx | 2 +- .../__tests__/__snapshots__/Button.test.tsx.snap | 7 ------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/packages/react/src/Button/ButtonBase.module.css b/packages/react/src/Button/ButtonBase.module.css index 7af731290da..eaa81e176c8 100644 --- a/packages/react/src/Button/ButtonBase.module.css +++ b/packages/react/src/Button/ButtonBase.module.css @@ -582,13 +582,13 @@ } } - /* PERFORMANCE: Use data-no-visuals attribute instead of :has(.Visual) to avoid descendant scan */ + /* PERFORMANCE: Use data-has-visuals attribute instead of :has(.Visual) to avoid descendant scan */ [data-a11y-link-underlines='true'] &:where([data-variant='link']) { - &:where([data-no-visuals='true']) { + &:not([data-has-visuals]) { text-decoration: underline; } - &:not([data-no-visuals='true']) { + &[data-has-visuals] { background-image: linear-gradient(to right, currentColor, currentColor); background-size: 100% 1.5px; background-position: 0 calc(100% - 2px); @@ -601,12 +601,12 @@ } [data-a11y-link-underlines='false'] &:where([data-variant='link']) { - &:where([data-no-visuals='true']) { + &:not([data-has-visuals]) { text-decoration: none; background-image: none; } - &:not([data-no-visuals='true']) { + &[data-has-visuals] { background-image: none; } } diff --git a/packages/react/src/Button/ButtonBase.tsx b/packages/react/src/Button/ButtonBase.tsx index d2ae5a0b6ba..3d73e8bce98 100644 --- a/packages/react/src/Button/ButtonBase.tsx +++ b/packages/react/src/Button/ButtonBase.tsx @@ -98,7 +98,7 @@ const ButtonBase = forwardRef(({children, as: Component = 'button', ...props}, f data-block={block ? 'block' : null} data-inactive={inactive ? true : undefined} data-loading={Boolean(loading)} - data-no-visuals={!LeadingVisual && !TrailingVisual && !TrailingAction ? true : undefined} + data-has-visuals={LeadingVisual || TrailingVisual || TrailingAction ? true : undefined} data-size={size} data-variant={variant} data-label-wrap={labelWrap} diff --git a/packages/react/src/Button/__tests__/__snapshots__/Button.test.tsx.snap b/packages/react/src/Button/__tests__/__snapshots__/Button.test.tsx.snap index 0e24734daa4..c2bcee3007b 100644 --- a/packages/react/src/Button/__tests__/__snapshots__/Button.test.tsx.snap +++ b/packages/react/src/Button/__tests__/__snapshots__/Button.test.tsx.snap @@ -5,7 +5,6 @@ exports[`Button > respects block prop 1`] = ` class="prc-Button-ButtonBase-Eb8-K" data-block="block" data-loading="false" - data-no-visuals="true" data-size="medium" data-variant="default" id="test-button" @@ -30,7 +29,6 @@ exports[`Button > respects the alignContent prop 1`] = `