mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
feat(segment): add missing focus state on segment for Ionic theme (#30074)
Issue number: internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> This is part of a bigger task to add focus styles on all components that need them on Ionic Theme. A separate PR will be done for each component. - Added new focus styles for segment on Ionic theme. - Added new state test and snapshots. - UI is slightly different from Figma, but t was discussed and aligned with UX/UI. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> - [Ionic Segment Focus](https://ionic-framework-ixz97yf70-ionic1.vercel.app/src/components/segment/test/a11y?ionic:theme=ionic)
This commit is contained in:
@ -79,6 +79,13 @@
|
||||
color: var(--color-disabled);
|
||||
}
|
||||
|
||||
// Segment Button: Focused
|
||||
// --------------------------------------------------
|
||||
|
||||
:host(.ion-focused) .button-inner {
|
||||
@include globals.focused-state();
|
||||
}
|
||||
|
||||
// Segment Button: Indicator
|
||||
// --------------------------------------------------
|
||||
|
||||
|
||||
29
core/src/components/segment/test/states/segment.e2e.ts
Normal file
29
core/src/components/segment/test/states/segment.e2e.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import { expect } from '@playwright/test';
|
||||
import { configs, test } from '@utils/test/playwright';
|
||||
|
||||
configs({ modes: ['ionic-md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('segment: states'), () => {
|
||||
test('should render focused segment correctly', async ({ page }) => {
|
||||
await page.setContent(
|
||||
`
|
||||
<ion-segment value="2">
|
||||
<ion-segment-button value="1">
|
||||
<ion-label>Bookmarks</ion-label>
|
||||
</ion-segment-button>
|
||||
<ion-segment-button class="ion-focused" value="2">
|
||||
<ion-label>Reading List</ion-label>
|
||||
</ion-segment-button>
|
||||
<ion-segment-button value="3">
|
||||
<ion-label>Shared Links</ion-label>
|
||||
</ion-segment-button>
|
||||
</ion-segment>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const segment = page.locator('ion-segment');
|
||||
|
||||
await expect(segment).toHaveScreenshot(screenshot(`segment-focused`));
|
||||
});
|
||||
});
|
||||
});
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.9 KiB |
Reference in New Issue
Block a user