Skip to content

Commit 149c665

Browse files
committed
Make it possible to keep the original box shadow of the component on focus
1 parent b213875 commit 149c665

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/docs/foundation/accessibility.mdx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ close button, [CheckboxField](/components/checkbox-field), or
2525
`--rui-tap-target-size` custom property (see
2626
[Theming](/customize/theming/overview) to learn how).
2727

28-
📖 [Read more about touch targets at Norman Nielsen Group.](https://www.nngroup.com/articles/touch-target-size/)
28+
📖 [Read more about touch targets at Norman Nielsen Group.][nn-group]
2929

3030
### Form Fields and Reserved Space
3131

@@ -59,6 +59,10 @@ custom properties:
5959

6060
- `--rui-focus-outline`,
6161
- `--rui-focus-outline-offset`,
62-
- `--rui-focus-box-shadow`.
62+
- `--rui-focus-box-shadow` (set to `initial` to keep the original box shadow
63+
if there is one).
6364

64-
📖 [Read more about keyboard accessibility at MDN.](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Keyboard)
65+
📖 [Read more about keyboard accessibility at MDN.][mdn-keyboard]
66+
67+
[nn-group]: https://www.nngroup.com/articles/touch-target-size/
68+
[mdn-keyboard]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Keyboard
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
// 1. Make it possible to keep the original box shadow of the component: if `--rui-focus-box-shadow` is set to
2+
// `initial`, `revert` or `unset`, `--rui-local-box-shadow` is used.
3+
14
$tap-target-size: var(--rui-tap-target-size);
25
$focus-outline: var(--rui-focus-outline);
36
$focus-outline-offset: var(--rui-focus-outline-offset);
4-
$focus-box-shadow: var(--rui-focus-box-shadow);
7+
$focus-box-shadow: var(--rui-focus-box-shadow, var(--rui-local-box-shadow, initial)); // 1.

src/lib/theme.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@
138138
//
139139
// Shared Settings
140140
// ===============
141+
//
142+
// 1. Use `initial`, `revert` or `unset` to keep the original box shadow of the component.
141143

142144
// Borders
143145
--rui-border-width: 1px;
@@ -151,7 +153,7 @@
151153
--rui-tap-target-size: 10mm;
152154
--rui-focus-outline: 0.2em solid var(--rui-color-active-focus);
153155
--rui-focus-outline-offset: 1px;
154-
--rui-focus-box-shadow: none;
156+
--rui-focus-box-shadow: initial; // 1.
155157

156158
// Bottom spacings
157159
--rui-spacing-bottom-default: var(--rui-spacing-5);

0 commit comments

Comments
 (0)