Skip to content

Commit

Permalink
[fix] 'accessibilityRequired' sets correct 'required' value
Browse files Browse the repository at this point in the history
Fix #2451
  • Loading branch information
necolas committed Jan 11, 2023
1 parent f34377d commit ca15203
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ describe('modules/createDOMProps', () => {
expect(props['aria-live']).toEqual('off');
});

test('prop "accessibilityRequired" becomes "aria-required" and "required"', () => {
const accessibilityRequired = false;
const props = createDOMProps('input', { accessibilityRequired });
expect(props['aria-required']).toEqual(false);
expect(props.required).toEqual(false);
});

test('prop "accessibilityRole" becomes "role"', () => {
const accessibilityRole = 'button';
const props = createProps({ accessibilityRole });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const createDOMProps = (elementType, props, options) => {
elementType === 'select' ||
elementType === 'textarea'
) {
domProps.required = true;
domProps.required = accessibilityRequired;
}
}
if (role != null) {
Expand Down

0 comments on commit ca15203

Please sign in to comment.