Skip to content

Commit 867d06d

Browse files
Add ARIA props
1 parent 579bc68 commit 867d06d

File tree

7 files changed

+106
-44
lines changed

7 files changed

+106
-44
lines changed

examples/src/examples/ExampleSlider.bs.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/rescript-mui-material/src/components/Dialog.res

-10
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,6 @@ type props = {
5252
*/
5353
@as("open")
5454
open_: bool,
55-
/**
56-
* The id(s) of the element(s) that describe the dialog.
57-
*/
58-
@as("aria-describedby")
59-
ariaDescribedby?: string,
60-
/**
61-
* The id(s) of the element(s) that label the dialog.
62-
*/
63-
@as("aria-labelledby")
64-
ariaLabelledby?: string,
6555
/**
6656
* Dialog children, usually the included sub-components.
6757
*/

packages/rescript-mui-material/src/components/InputBase.res

-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ type inputBaseComponentProps = {
5858
min?: int,
5959
max?: int,
6060
@as("type") type_?: string,
61-
@as("aria-labelledby") ariaLabelledby?: string,
6261
@as("disableunderline") disableUnderline?: string,
6362
maxLength?: int,
6463
} // FIXME: there is more
@@ -98,7 +97,6 @@ type slots = {
9897

9998
type publicProps<'value> = {
10099
...CommonProps.t_NoId,
101-
@as("aria-describedby") ariaDescribedby?: string,
102100
/**
103101
* This prop helps users to fill forms faster, especially on mobile devices.
104102
* The name can be confusing, as it's more like an autofill.

packages/rescript-mui-material/src/components/Slider.res

-15
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,6 @@ type valueLabelFormat<'value> =
125125

126126
type sliderProps<'value> = {
127127
...CommonProps.t,
128-
/**
129-
* The label of the slider.
130-
*/
131-
@as("aria-label")
132-
ariaLabel?: string,
133-
/**
134-
* The id of the element containing a label for the slider.
135-
*/
136-
@as("aria-labelledby")
137-
ariaLabelledby?: string,
138-
/**
139-
* A string value that provides a user-friendly name for the current value of the slider.
140-
*/
141-
@as("aria-valuetext")
142-
ariaValuetext?: string,
143128
/**
144129
* Override or extend the styles applied to the component.
145130
*/

packages/rescript-mui-material/src/components/SpeedDial.res

-5
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@ type openReason =
3636

3737
type props = {
3838
...CommonProps.t,
39-
/**
40-
* The aria-label of the button element.
41-
* Also used to provide the `id` for the `SpeedDial` element and its children.
42-
*/
43-
ariaLabel: string,
4439
/**
4540
* SpeedDialActions to display when the SpeedDial is `open`.
4641
*/

packages/rescript-mui-material/src/components/Tabs.res

-10
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,6 @@ type publicProps = {
8989
* @default false
9090
*/
9191
allowScrollButtonsMobile?: bool,
92-
/**
93-
* The label for the Tabs as a string.
94-
*/
95-
@as("aria-label")
96-
ariaLabel?: string,
97-
/**
98-
* An id or list of ids separated by a space that label the Tabs.
99-
*/
100-
@as("aria-labelledby")
101-
ariaLabelledby?: string,
10292
/**
10393
* If `true`, the tabs are centered.
10494
* This prop is intended for large views.

packages/rescript-mui-material/src/types/CommonProps.res

+104
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,108 @@
1+
type ariaProps = {
2+
/* accessibility */
3+
/* https://www.w3.org/TR/wai-aria-1.1/ */
4+
/* https://accessibilityresources.org/<aria-tag> is a great resource for these */
5+
@as("aria-current")
6+
ariaCurrent?: [#page | #step | #location | #date | #time | #"true" | #"false"],
7+
@as("aria-details")
8+
ariaDetails?: string,
9+
@as("aria-disabled")
10+
ariaDisabled?: bool,
11+
@as("aria-hidden")
12+
ariaHidden?: bool,
13+
@as("aria-invalid") ariaInvalid?: [#grammar | #"false" | #spelling | #"true"],
14+
@as("aria-keyshortcuts")
15+
ariaKeyshortcuts?: string,
16+
@as("aria-label")
17+
ariaLabel?: string,
18+
@as("aria-roledescription")
19+
ariaRoledescription?: string,
20+
/* Widget Attributes */
21+
@as("aria-autocomplete") ariaAutocomplete?: [#inline | #list | #both | #none],
22+
/* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */
23+
@as("aria-checked")
24+
ariaChecked?: [#"true" | #"false" | #mixed],
25+
@as("aria-expanded")
26+
ariaExpanded?: bool,
27+
@as("aria-haspopup")
28+
ariaHaspopup?: [#menu | #listbox | #tree | #grid | #dialog | #"true" | #"false"],
29+
@as("aria-level")
30+
ariaLevel?: int,
31+
@as("aria-modal")
32+
ariaModal?: bool,
33+
@as("aria-multiline")
34+
ariaMultiline?: bool,
35+
@as("aria-multiselectable")
36+
ariaMultiselectable?: bool,
37+
@as("aria-orientation") ariaOrientation?: [#horizontal | #vertical | #undefined],
38+
@as("aria-placeholder")
39+
ariaPlaceholder?: string,
40+
/* https://www.w3.org/TR/wai-aria-1.1/#valuetype_tristate */
41+
@as("aria-pressed") ariaPressed?: [#"true" | #"false" | #mixed],
42+
@as("aria-readonly")
43+
ariaReadonly?: bool,
44+
@as("aria-required")
45+
ariaRequired?: bool,
46+
@as("aria-selected")
47+
ariaSelected?: bool,
48+
@as("aria-sort")
49+
ariaSort?: string,
50+
@as("aria-valuemax")
51+
ariaValuemax?: float,
52+
@as("aria-valuemin")
53+
ariaValuemin?: float,
54+
@as("aria-valuenow")
55+
ariaValuenow?: float,
56+
@as("aria-valuetext")
57+
ariaValuetext?: string,
58+
/* Live Region Attributes */
59+
@as("aria-atomic")
60+
ariaAtomic?: bool,
61+
@as("aria-busy")
62+
ariaBusy?: bool,
63+
@as("aria-live") ariaLive?: [#off | #polite | #assertive | #rude],
64+
@as("aria-relevant")
65+
ariaRelevant?: string,
66+
/* Drag-and-Drop Attributes */
67+
@as("aria-dropeffect") ariaDropeffect?: [#copy | #move | #link | #execute | #popup | #none],
68+
@as("aria-grabbed")
69+
ariaGrabbed?: bool,
70+
/* Relationship Attributes */
71+
@as("aria-activedescendant")
72+
ariaActivedescendant?: string,
73+
@as("aria-colcount")
74+
ariaColcount?: int,
75+
@as("aria-colindex")
76+
ariaColindex?: int,
77+
@as("aria-colspan")
78+
ariaColspan?: int,
79+
@as("aria-controls")
80+
ariaControls?: string,
81+
@as("aria-describedby")
82+
ariaDescribedby?: string,
83+
@as("aria-errormessage")
84+
ariaErrormessage?: string,
85+
@as("aria-flowto")
86+
ariaFlowto?: string,
87+
@as("aria-labelledby")
88+
ariaLabelledby?: string,
89+
@as("aria-owns")
90+
ariaOwns?: string,
91+
@as("aria-posinset")
92+
ariaPosinset?: int,
93+
@as("aria-rowcount")
94+
ariaRowcount?: int,
95+
@as("aria-rowindex")
96+
ariaRowindex?: int,
97+
@as("aria-rowspan")
98+
ariaRowspan?: int,
99+
@as("aria-setsize")
100+
ariaSetsize?: int,
101+
}
102+
1103
type t_NoId = {
104+
// Cannot spread whole dom props since overwriting is not possible.
105+
...ariaProps,
2106
className?: string,
3107
style?: ReactDOM.Style.t,
4108
ref?: ReactDOM.domRef,

0 commit comments

Comments
 (0)