@react-ui-org/react-ui 0.49.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-ui-org/react-ui",
3
3
  "description": "React UI is a themeable UI library for React apps.",
4
- "version": "0.49.0",
4
+ "version": "0.50.0",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",
@@ -54,7 +54,6 @@ export const FileInputField = React.forwardRef((props, ref) => {
54
54
  <div className={styles.inputContainer}>
55
55
  <input
56
56
  {...transferProps(restProps)}
57
- className={styles.input}
58
57
  disabled={disabled}
59
58
  id={id}
60
59
  ref={ref}
@@ -17,10 +17,6 @@
17
17
  @include box-field-elements.input-container();
18
18
  }
19
19
 
20
- .input {
21
- @include accessibility.focus-ring();
22
- }
23
-
24
20
  .helpText,
25
21
  .validationText {
26
22
  @include foundation.help-text();
@@ -110,7 +110,7 @@ export const Modal = ({
110
110
  const childrenWrapperElement = childrenWrapperRef.current;
111
111
  const childrenElements = childrenWrapperElement.querySelectorAll('*');
112
112
  const formFieldEl = Array.from(childrenElements).find(
113
- (element) => ['INPUT', 'TEXTAREA', 'SELECT'].includes(element.nodeName),
113
+ (element) => ['INPUT', 'TEXTAREA', 'SELECT'].includes(element.nodeName) && !element.disabled,
114
114
  );
115
115
 
116
116
  if (formFieldEl) {
@@ -115,10 +115,10 @@ See [API](#api) for all available options.
115
115
  - **Modal actions** should correspond to the modal purpose, too. E.g. “Delete”
116
116
  tells better what happens rather than “OK”.
117
117
 
118
- - Modal **automatically focuses the first form field** by default which allows
119
- users to confirm the modal by hitting the enter key. When no field is found
120
- then the primary button (in the footer) is focused. To turn this feature off,
121
- set the `autofocus` prop to `false`.
118
+ - Modal **automatically focuses the first non-disabled form field** by default
119
+ which allows users to confirm the modal by hitting the enter key. When no
120
+ field is found then the primary button (in the footer) is focused. To turn
121
+ this feature off, set the `autofocus` prop to `false`.
122
122
 
123
123
  - **Avoid stacking** of modals. While it may technically work, the modal is just
124
124
  not designed for that.
@@ -841,8 +841,9 @@ Autofocus is implemented to enhance the user experience by automatically
841
841
  focussing an element within the modal.
842
842
 
843
843
  How does it work? It tries to find `input`, `textarea`, and `select` elements
844
- inside of Modal and moves focus into the first found. If none is found and the
845
- `primaryButtonRef` prop on Modal is set, then the primary button is focused.
844
+ inside of Modal and moves focus onto the first non-disabled one. If none is
845
+ found and the `primaryButtonRef` prop on Modal is set, then the primary button
846
+ is focused.
846
847
 
847
848
  Autofocus is enabled by default, so if you want to control the focus of
848
849
  elements manually, set the `autoFocus` prop on Modal to `false`.
@@ -1,9 +1,13 @@
1
- // Remove focus outline as we implement custom appearance of focus state.
2
- button:focus,
3
- input:focus,
4
- select:focus,
5
- textarea:focus {
6
- outline: 0;
1
+ @use "../tools/accessibility";
2
+
3
+ // Remove focus outline as we implement custom appearance of focus state. Increase specificity where necessary to
4
+ // override normalize.css.
5
+ :where(button, input, select, textarea):focus {
6
+ outline: none;
7
+ }
8
+
9
+ :is(a, button, input, select, textarea, [type="button"], [type="submit"]) {
10
+ @include accessibility.focus-ring();
7
11
  }
8
12
 
9
13
  // Reset Chrome and Firefox behaviour which sets a `min-width: min-content;` on fieldsets.
@@ -1,2 +1,4 @@
1
1
  $tap-target-size: var(--rui-tap-target-size);
2
+ $focus-outline: var(--rui-focus-outline);
3
+ $focus-outline-offset: var(--rui-focus-outline-offset);
2
4
  $focus-box-shadow: var(--rui-focus-box-shadow);
@@ -13,6 +13,7 @@ $label-font-size: var(--rui-FormField__label__font-size);
13
13
  $help-text-font-size: var(--rui-FormField__help-text__font-size);
14
14
  $help-text-font-style: var(--rui-FormField__help-text__font-style);
15
15
  $help-text-color: var(--rui-FormField__help-text__color);
16
+ $required-label-color: var(--rui-FormField--required__label__color);
16
17
  $required-sign: var(--rui-FormField--required__sign);
17
18
  $required-sign-color: var(--rui-FormField--required__sign__color);
18
19
 
@@ -46,6 +46,8 @@
46
46
 
47
47
  @mixin focus-ring() {
48
48
  &:focus-visible {
49
+ outline: theme.$focus-outline;
50
+ outline-offset: theme.$focus-outline-offset;
49
51
  box-shadow: theme.$focus-box-shadow;
50
52
  }
51
53
  }
@@ -12,6 +12,8 @@
12
12
  }
13
13
 
14
14
  @mixin label-required() {
15
+ color: var(--rui-local-surrounding-text-color, #{theme.$required-label-color});
16
+
15
17
  &::after {
16
18
  content: theme.$required-sign;
17
19
  color: theme.$required-sign-color;
@@ -149,7 +149,9 @@
149
149
 
150
150
  // Accessibility
151
151
  --rui-tap-target-size: 10mm;
152
- --rui-focus-box-shadow: 0 0 0 0.2em var(--rui-color-active-focus);
152
+ --rui-focus-outline: 0.2em solid var(--rui-color-active-focus);
153
+ --rui-focus-outline-offset: 1px;
154
+ --rui-focus-box-shadow: none;
153
155
 
154
156
  // Bottom spacings
155
157
  --rui-spacing-bottom-default: var(--rui-spacing-5);
@@ -738,6 +740,7 @@
738
740
  --rui-FormField__help-text__font-size: var(--rui-typography-size-small);
739
741
  --rui-FormField__help-text__font-style: normal;
740
742
  --rui-FormField__help-text__color: var(--rui-color-gray-500);
743
+ --rui-FormField--required__label__color: inherit;
741
744
  --rui-FormField--required__sign: "\00a0*"; // 2.
742
745
  --rui-FormField--required__sign__color: var(--rui-color-gray-500);
743
746