노드에 tabIndex 설정 (-1 이외)이 있으면 포커스를 클릭하면 포커스가 설정됩니다. tabIndex 설정을 제거하면 해당 동작이 중지되므로 클릭이 영향을 미치지 않습니다.포커스 가능 요소를 웹킷에서 unfocusable으로 만듭니다.
그러나 webkit에서는 노드에 tabIndex가 있으면 tabIndex를 제거한 후에도 노드를 계속 클릭하고 포커스를받을 수 있습니다. tabIndex = -1로 설정하면 동일한 클릭 문제가 발생합니다.
누구나이 문제의 해결 방법을 알고 계십니까?
<div id="one">one (no initial tabindex)</div>
<div id="two" tabindex=0>two (initially tabindex=0)</div>
<button type=button onclick="document.getElementById('one').setAttribute('tabindex', 0)">set tabindex on first div</button>
<button type=button onclick="document.getElementById('one').removeAttribute('tabindex', 0)">remove tabindex on first div</button>
<button type=button onclick="document.getElementById('two').removeAttribute('tabindex', 0)">remove tabindex on second div</button>
<button type=button onclick="document.getElementById('one').setAttribute('tabindex', -1)">set tabindex=1 on first div</button>
<button type=button onclick="document.getElementById('two').setAttribute('tabindex', -1)">set tabindex=1 on second div</button>
그냥이 문제를 직접 발견했습니다 ... 저주받은 성가신 일입니다. – RwwL
Safari/WebKit의 어떤 버전입니까? –
Chrome 8.0.552.231에서 방금 시도했지만 여전히 발생했습니다. 처음에 테스트 한 웹킷 버전은 확실하지 않습니다. –