use object with empty prototype chain for tag names

This commit is contained in:
NikolaBorislavovHristov 2019-08-04 10:08:33 +03:00
parent 9d4fd268ae
commit 7698c4351a

View file

@ -5,14 +5,14 @@ const { useFocusable } = require('../FocusableContext');
const ENTER_KEY_CODE = 13;
const BUTTON_INPUT_TYPES = ['button', 'link', 'checkbox'];
const TEXT_INPUT_TYPES = ['text', 'email', 'password'];
const TAG_NAMES_FOR_TYPE = {
const TAG_NAMES_FOR_TYPE = Object.assign(Object.create(null), {
button: 'div',
link: 'a',
checkbox: 'input',
text: 'input',
email: 'input',
password: 'input'
};
});
const Input = React.forwardRef(({ type, tabIndex, children, ...props }, ref) => {
const focusable = useFocusable();