# ally.fix.pointerFocusParent
This Browser Bug Workaround targets an issue in old Blink and WebKit causing focus (by MouseEvent
and TouchEvent
) to be given to the next parent element accepting focus, rather than the element the event was dispatched to.
# Description
Considering the following markup, clicking on the <a>
element would focus the <div>
instead:
<div tabindex="-1">
<a href="https://example.org/">Hello World</a>
</div>
# Usage
// engage the workaround for the entire document
var handle = ally.fix.pointerFocusParent();
// disengage the workaround
handle.disengage();
// engage the workaround only for a sub-tree
var handle = ally.fix.pointerFocusParent({
context: '#element-to-fix',
});
# Arguments
Name | Type | Default | Description |
---|---|---|---|
context | <selector> |
document |
The scope of the DOM in which to apply the fix. All elements of the collections are used. |
# Returns
A <service>
interface, providing the handle.disengage()
method to stop the service.
# Examples
# ally.fix.pointerFocusParent Example
play with ally.fix.pointerFocusParent Example on jsbin.com or open the document of ally.fix.pointerFocusParent Example
# Notes
Only engaged for WebKit (detected via via platform.js).