Skip to content

fix(tab-button): dark palette focused background color#31050

Open
gnbm wants to merge 5 commits intomainfrom
FW-6293
Open

fix(tab-button): dark palette focused background color#31050
gnbm wants to merge 5 commits intomainfrom
FW-6293

Conversation

@gnbm
Copy link
Copy Markdown
Contributor

@gnbm gnbm commented Mar 30, 2026

Issue number: resolves resolves internal


What is the current behavior?

In the dark palette, the --ion-tab-bar-background-focused CSS token was not defined.
When a ion-tab-button receives focus, the ::after overlay on .button-native falls back to get-color-shade(#fff)#e0e0e0 — a light grey that blends into the dark background and makes the focus indicator invisible.

What is the new behavior?

  • --ion-tab-bar-background-focused is now defined in the dark palette: #0b0b0b for iOS (shade of the near-black iOS tab bar) and #1b1b1b for MD (shade of --ion-tab-bar-background: #1f1f1f), providing a dark-appropriate focus indicator.
    The same token is added to high-contrast-dark.scss with the same values.
  • A screenshot e2e test is added under tab-button/test/states/ (where the existing focused-state tests live) using configs({ palettes: ['dark'] }) and page.setContent() with class="ion-focused" applied directly, matching the established pattern for focus-state testing in this component.

Does this introduce a breaking change?

  • Yes
  • No

Other information

The test triggers keyboard mode (required by focus-visible.ts) before focusing the inner <a> element inside the tab button's shadow DOM, since calling .focus() on the host element is a no-op without delegatesFocus.

@gnbm gnbm added package: core @ionic/core package type: bug a confirmed bug report labels Mar 30, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment Mar 31, 2026 5:27pm

Request Review

@gnbm gnbm marked this pull request as ready for review March 30, 2026 22:20
@gnbm gnbm requested a review from a team as a code owner March 30, 2026 22:20
@gnbm gnbm requested a review from brandyscarney March 30, 2026 22:20
@ShaneK ShaneK changed the title fix(tab-button): apply correct focused background color in dark palette fix(tab-button): dark palette focused background color Mar 31, 2026
Copy link
Copy Markdown
Member

@ShaneK ShaneK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvements! A couple of new things

config
);

await expect(page.locator('ion-tab-bar')).toHaveScreenshot(screenshot('tab-bar-focused-dark'));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screenshot('tab-bar-focused-dark') ends up with -dark twice in the filename since configs({ palettes: ['dark'] }) appends it automatically. Also, the other screenshots in this file all use a tab-button-focus- prefix, not tab-bar-. Something like screenshot('tab-button-focus') would match both conventions.

Small thing too: the other tests in this file pull out const tabBar = page.locator('ion-tab-bar') before the assertion (lines 19, 35, 59, 77). You should consider matching this style for consistency

});
});

configs({ palettes: ['dark'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other two blocks in this file nest tests inside test.describe('focus', ...). Should this follow the same pattern? Something like title('tab-button: states in dark palette') with a nested test.describe('focus', ...) inside

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package type: bug a confirmed bug report

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants