Skip to content

Latest commit

 

History

History
59 lines (34 loc) · 1.27 KB

focus-target.md

File metadata and controls

59 lines (34 loc) · 1.27 KB
layout tags
doc-api.html
internal, argument-list

ally.get.focusTarget

Identifies the element that would get focus upon click

Description

When clicking on the <span> element, focus is given to the <div>, because it's the first focusable parent element.

<div tabindex="-1">
  <p>Hello <span>World</span>!</p>
</div>

Usage

var element = ally.get.focusTarget({
  context: '#element-to-start-from',
});

Arguments

Name Type Default Description
context <selector> required The element to start searching from. The first element of a collection is used.

Returns

HTMLElement.

Throws

TypeError if context option is not specified.

Examples

Notes

Related Resources

Contributing