mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
Add support for ARIA 1.3 attributes (#34264)
Co-authored-by: Abdulwahab Omira <abdulwahabomira@gmail.com> Co-authored-by: Sebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
This commit is contained in:
parent
11d7bcf88c
commit
698bb4deb7
|
|
@ -59,6 +59,11 @@ const ariaProperties = {
|
||||||
'aria-rowindex': 0,
|
'aria-rowindex': 0,
|
||||||
'aria-rowspan': 0,
|
'aria-rowspan': 0,
|
||||||
'aria-setsize': 0,
|
'aria-setsize': 0,
|
||||||
|
// ARIA 1.3 Attributes
|
||||||
|
'aria-braillelabel': 0,
|
||||||
|
'aria-brailleroledescription': 0,
|
||||||
|
'aria-colindextext': 0,
|
||||||
|
'aria-rowindextext': 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ariaProperties;
|
export default ariaProperties;
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,27 @@ describe('ReactDOMInvalidARIAHook', () => {
|
||||||
it('should allow valid aria-* props', async () => {
|
it('should allow valid aria-* props', async () => {
|
||||||
await mountComponent({'aria-label': 'Bumble bees'});
|
await mountComponent({'aria-label': 'Bumble bees'});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should allow new ARIA 1.3 attributes', async () => {
|
||||||
|
// Test aria-braillelabel
|
||||||
|
await mountComponent({'aria-braillelabel': 'Braille label text'});
|
||||||
|
|
||||||
|
// Test aria-brailleroledescription
|
||||||
|
await mountComponent({'aria-brailleroledescription': 'Navigation menu'});
|
||||||
|
|
||||||
|
// Test aria-colindextext
|
||||||
|
await mountComponent({'aria-colindextext': 'Column A'});
|
||||||
|
|
||||||
|
// Test aria-rowindextext
|
||||||
|
await mountComponent({'aria-rowindextext': 'Row 1'});
|
||||||
|
|
||||||
|
// Test multiple ARIA 1.3 attributes together
|
||||||
|
await mountComponent({
|
||||||
|
'aria-braillelabel': 'Braille text',
|
||||||
|
'aria-colindextext': 'First column',
|
||||||
|
'aria-rowindextext': 'First row',
|
||||||
|
});
|
||||||
|
});
|
||||||
it('should warn for one invalid aria-* prop', async () => {
|
it('should warn for one invalid aria-* prop', async () => {
|
||||||
await mountComponent({'aria-badprop': 'maybe'});
|
await mountComponent({'aria-badprop': 'maybe'});
|
||||||
assertConsoleErrorDev([
|
assertConsoleErrorDev([
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user