playbook_ui 14.25.0.pre.alpha.PLAY2413togglefocusstate9789 → 14.25.0.pre.alpha.PLAY2422fixedconftoastaccessibility9840

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de6d77764e1005d84f779b54ad0d3c2e2f5ee63c1691aed260cf27c693218404
4
- data.tar.gz: 145ef5440f3929315bf4c3d99a29f50e1caa587d0672ce09d145878cb650939b
3
+ metadata.gz: 1dc9dcfd7fc8bed8ccd07cbec3b1ec442d15dbb66207cff99291683c3fcb5bf4
4
+ data.tar.gz: 1b0852b24cf432723f49cd373243f671041cdb5e2570ef971007b8efa293a62b
5
5
  SHA512:
6
- metadata.gz: 22c3c0a055a6d6f1743bcdabbd23e5a7cb6b1fa0f103e29db749364b85b8012fb2438cf0008877d14465545d033e6ef136220b569b6438c4589c028aea9ff7b0
7
- data.tar.gz: b4f81fcd52d01d76e0d03cdf23df691384a1c8f24d2dc76f85b4759d045d2734a920fb624b08cf5e55cb1b1b102ff245f572379a9c362103d270c73cf3d64158
6
+ metadata.gz: a1c5fc5ee7cc4377f5541a5ffbfedf0d054364004bad811e7d16d7500188c867e84b36d91a97119c7118cc1a301ba0b5ad37267d29332de54ad9ff2d67a6ba1c
7
+ data.tar.gz: e3e5cdf76e498f93d7bb97f653cf61288b05d8c3b6df6055f4e3de5e4dfdb9048448269775873ce8787417ae0fc15842e4266317858c1b68def2f5fc1812867d
@@ -35,6 +35,8 @@ type FixedConfirmationToastProps = {
35
35
 
36
36
  const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.ReactElement => {
37
37
  const [showToast, toggleToast] = useState(true);
38
+ const [hydrated, setHydrated] = useState(false);
39
+
38
40
  const {
39
41
  autoClose = 0,
40
42
  children,
@@ -84,12 +86,24 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
84
86
  onClose();
85
87
  };
86
88
 
89
+ // prevents Screen Reader from announcing all examples on page load, just dynamic on open
90
+ useEffect(() => {
91
+ setHydrated(true);
92
+ }, []);
93
+
87
94
  return (
88
95
  <>
89
96
  {showToast && (
90
97
  <div
98
+ aria-atomic={hydrated && open ? "true" : undefined}
99
+ aria-live={hydrated && open ? "polite" : undefined}
91
100
  className={css}
92
101
  onClick={handleClick}
102
+ onKeyDown={(e) => {
103
+ if (e.key === "Enter" || e.key === " ") handleClick();
104
+ }}
105
+ role="status"
106
+ tabIndex={0}
93
107
  {...htmlProps}
94
108
  >
95
109
  {returnedIcon && icon !== "none" && (
@@ -112,6 +126,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
112
126
 
113
127
  {closeable && (
114
128
  <Icon
129
+ aria={{ "label": "Close Toast" }}
115
130
  className="pb_icon"
116
131
  cursor="pointer"
117
132
  fixedWidth={false}
@@ -1,6 +1,6 @@
1
- <%= pb_content_tag do %>
1
+ <%= pb_content_tag(:div, "aria-atomic": "true", "aria-live": "polite", role: "status", tabindex: 0) do %>
2
2
  <% if object.icon_value && object.icon_value != "none" %>
3
- <%= pb_rails("icon", props: { icon: object.icon_value, classname: "pb_icon", fixed_width: true }) %>
3
+ <%= pb_rails("icon", props: { icon: object.icon_value, classname: "pb_icon", fixed_width: true, aria: { "aria-label": "#{object.icon_value} icon" } }) %>
4
4
  <% end %>
5
5
  <% if content %>
6
6
  <%= content %>
@@ -8,5 +8,5 @@
8
8
  <%= pb_rails("title", props: { text: object.text, size: 4, flex: "1", classname: "pb_fixed_confirmation_toast_text" }) %>
9
9
  <% end %>
10
10
 
11
- <%= pb_rails("icon", props: { icon: "times", classname: "pb_icon", cursor: "pointer", fixed_width: true }) if object.closeable %>
11
+ <%= pb_rails("icon", props: { icon: "times", classname: "pb_icon", cursor: "pointer", fixed_width: true, aria: { "aria-label": "Close Toast" } }) if object.closeable %>
12
12
  <% end %>
@@ -46,16 +46,7 @@ $transition: .2s ease-in-out;
46
46
  }
47
47
 
48
48
  input {
49
- position: absolute;
50
- opacity: 0;
51
- width: 1px;
52
- height: 1px;
53
- overflow: hidden;
54
-
55
- &:focus + .pb_toggle_control {
56
- box-shadow: 0px 0px 0px 2px $white, 0px 0px 0px 4px $primary;
57
- outline: none;
58
- }
49
+ display: none;
59
50
 
60
51
  &:disabled + .pb_toggle_control {
61
52
  cursor: not-allowed;
@@ -70,11 +61,7 @@ $transition: .2s ease-in-out;
70
61
  }
71
62
 
72
63
  input:checked {
73
- position: absolute;
74
- opacity: 0;
75
- width: 1px;
76
- height: 1px;
77
- overflow: hidden;
64
+ display: none;
78
65
 
79
66
  &:checked + .pb_toggle_control {
80
67
  border: $border_success;
@@ -86,11 +73,6 @@ $transition: .2s ease-in-out;
86
73
  }
87
74
  }
88
75
 
89
- &:checked:focus + .pb_toggle_control {
90
- box-shadow: 0px 0px 0px 2px $white, 0px 0px 0px 4px $primary;
91
- outline: none;
92
- }
93
-
94
76
  &:disabled + .pb_toggle_control {
95
77
  cursor: not-allowed;
96
78
  opacity: 0.5;
@@ -23,7 +23,6 @@ type Props = {
23
23
  name?: string,
24
24
  onChange?: InputCallback<HTMLInputElement>,
25
25
  size?: "sm" | "md",
26
- tabIndex?: number,
27
26
  value?: string,
28
27
  } & GlobalProps
29
28
 
@@ -41,7 +40,6 @@ const Toggle = ({
41
40
  // Function body here
42
41
  },
43
42
  size = 'sm',
44
- tabIndex,
45
43
  value,
46
44
  ...props
47
45
  }: Props): React.ReactElement => {
@@ -75,7 +73,6 @@ const Toggle = ({
75
73
  disabled={disabled}
76
74
  name={name}
77
75
  onChange={onChange}
78
- tabIndex={tabIndex}
79
76
  type="checkbox"
80
77
  value={value}
81
78
  />
@@ -1,11 +1,9 @@
1
1
  <%= pb_rails("toggle", props: {
2
- checked: true,
3
- input_options: { tabindex: 0 }
2
+ checked: true
4
3
  }) %>
5
4
 
6
5
  <br>
7
6
 
8
7
  <%= pb_rails("toggle", props: {
9
- checked: false,
10
- input_options: { tabindex: 0 }
8
+ checked: false
11
9
  }) %>
@@ -6,12 +6,11 @@ const ToggleDefault = () => {
6
6
  <>
7
7
  <Toggle
8
8
  checked
9
- tabIndex={0}
10
9
  />
11
10
 
12
11
  <br />
13
12
 
14
- <Toggle tabIndex={0} />
13
+ <Toggle />
15
14
  </>
16
15
  )
17
16
  }