Skip to content

Commit b7da1e8

Browse files
BenOsodracIonitronthetaPC
authored
feat(select): add focus on tab (#30076)
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. --> - Added focus styles on tab for the ion-select, using the --highlight variable. - Adjusted highlight tests to work for ionic as well, just for the outline type. - Fixed select border-color token used and updated snapshots (this affected all ionic theme snapshots for select). Although not directly related to focus task, the incorrect color was making it very hard to see the differences between the focus colors. ## 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. --> - [Select focus](https://ionic-framework-git-rou-11445-select-ionic1.vercel.app/src/components/select/test/highlight?ionic:theme=ionic) --------- Co-authored-by: ionitron <[email protected]> Co-authored-by: Maria Hutt <[email protected]>
1 parent 3091390 commit b7da1e8

File tree

45 files changed

+71
-43
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+71
-43
lines changed

core/src/components/select/select.ionic.outline.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,23 @@
5050

5151
box-sizing: border-box;
5252
}
53+
54+
// Focus
55+
// ---------------------------------------------
56+
57+
:host(.ion-focused.select-fill-outline) {
58+
--border-color: var(--highlight-color);
59+
}
60+
61+
:host(.ion-focused.select-fill-outline:not(.ion-invalid):not(.ion-valid)) {
62+
--border-width: #{globals.$ion-border-size-050};
63+
}
64+
65+
/**
66+
* If the select has a validity state, the
67+
* border should reflect that as a color.
68+
*/
69+
:host(.has-focus.select-fill-outline.ion-valid),
70+
:host(.select-fill-outline.ion-touched.ion-invalid) {
71+
--border-color: var(--highlight-color);
72+
}

core/src/components/select/select.ionic.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99
--background: #{globals.$ion-primitives-base-white};
1010
// TODO(ROU-10778, ROU-10875): Sync the color names to the design system of
1111
// ios and md. This will allow us to have a single color map.
12-
--border-color: #{globals.current-color(neutral)};
12+
--border-color: #{globals.$ion-primitives-neutral-500};
1313
--border-width: #{globals.$ion-border-size-025};
1414
--padding-start: #{globals.$ion-space-400};
1515
--padding-end: #{globals.$ion-space-400};
1616
--padding-top: #{globals.$ion-space-300};
1717
--padding-bottom: #{globals.$ion-space-300};
1818
--placeholder-color: #{globals.$ion-primitives-neutral-800};
1919
--placeholder-opacity: 1;
20+
--highlight-color-focused: #{globals.$ion-border-focus-default};
21+
--highlight-color-valid: #{globals.$ion-semantics-success-900};
22+
--highlight-color-invalid: #{globals.$ion-semantics-danger-800};
2023
}
2124

2225
// Select Label
-50 Bytes
-17 Bytes
-63 Bytes
-62 Bytes
-44 Bytes
-56 Bytes

0 commit comments

Comments
 (0)