InputBox: tune input attributes

This commit is contained in:
He4eT 2023-06-03 22:02:33 +03:00
commit 7e2de6b269
2 changed files with 20 additions and 5 deletions

View file

@ -1,6 +1,8 @@
import { h } from 'preact' import { h } from 'preact'
import { useEffect, useRef, useState } from 'preact/hooks' import { useEffect, useRef, useState } from 'preact/hooks'
import s from './InputBox/MenuButton.module.scss'
/* eslint-disable */ /* eslint-disable */
const keyCodes = { const keyCodes = {
KEY_BACKSPACE: 8, KEY_BACKSPACE: 8,
@ -111,9 +113,6 @@ export default function InputBox ({
const inputHandlers = { const inputHandlers = {
char: { char: {
maxlength: '1', maxlength: '1',
autocapitalize: 'off',
autocorrect: 'off',
spellcheck: 'false',
placeholder: 'Press any key here', placeholder: 'Press any key here',
onKeyDown: charHandler, onKeyDown: charHandler,
}, },
@ -136,12 +135,15 @@ export default function InputBox ({
value={inputText} value={inputText}
autofocus autofocus
autocomplete='off' autocomplete='off'
spellCheck='false'
autocapitalize='off'
autocorrect='off'
onDblClick={onFullscreenRequest} onDblClick={onFullscreenRequest}
onInput={({ target: { value } }) => setInputText(value)} onInput={({ target: { value } }) => setInputText(value)}
type='text' /> type='search' />
<button <button
aria-label='Menu' aria-label='Menu'
className='menuButton' className={s.menuButton}
onClick={() => setMenuOpen(true)} onClick={() => setMenuOpen(true)}
> >
= =

View file

@ -0,0 +1,13 @@
.menuButton {
border-left: none;
outline-offset: -8px;
position: absolute;
right: 0;
height: 100%;
padding: 0;
aspect-ratio: 1;
&:focus-visible {
outline-offset: -4px;
}
}