mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-27 17:51:20 -08:00
refactor(core): [CORE-23] complete keyboard controls and focus lifecycle
This commit is contained in:
1 parent
faaa3e8c2d
commit
8ed0a5228c
190 files changed
+53981
-489
No files matched your search
@@ -1,5 +1,7 @@
|
||||
import type { ControlFactory, ControlOption } from './types'
|
||||
import { keyboardButton } from '../accessibility/button'
|
||||
import { appendElement } from '../component/dom'
|
||||
import { entryScope } from '../component/resources'
|
||||
import { tooltip } from '../utils'
|
||||
import { controlEvents } from './resources'
|
||||
|
||||
@@ -12,6 +14,8 @@ export default function setting(option: ControlOption): ControlFactory {
|
||||
const { icons, i18n } = art
|
||||
|
||||
appendElement($control, icons.setting)
|
||||
keyboardButton(entryScope($control), $control)
|
||||
$control.setAttribute('aria-expanded', 'false')
|
||||
|
||||
proxy($control, 'click', () => {
|
||||
art.setting.toggle()
|
||||
@@ -19,6 +23,7 @@ export default function setting(option: ControlOption): ControlFactory {
|
||||
})
|
||||
|
||||
on('setting', (value) => {
|
||||
$control.setAttribute('aria-expanded', String(value))
|
||||
tooltip($control, i18n.get(value ? 'Hide Setting' : 'Show Setting'))
|
||||
})
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user