lrud
lrud copied to clipboard
Trigger callbacks and events on focus/blur within
Description
Adds the onFocusWithin
and onBlurWithin
functions, and the focusWithin
and blurWithin
events. These are triggered when focus moved into/out of a parent node.
Consider the following tree:
root
|-- alpha
| |-- alpha_1
|-- bravo
| |-- bravo_1
Focus is first assigned to alpha_1
. This triggers focusWithin
events for alpha
and root
. When focus moves to bravo_1
, a blurWithin
event is triggered for alpha
, and a focusWithin
event is triggered for bravo
. No further events are triggered for root
as focus remains within it.
Motivation and Context
See #96 for an example of the issue this solves. I did not want to adjust the way activation works as this will break the TAL specification, and may potentially be a breaking change for some projects. Instead, I propose these new events to allow people to track the movement of focus between parents.
Resolves: #96
How Has This Been Tested?
All current tests pass and I have added additional tests for these callbacks.
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
- [x] My code follows the code style of this project.
- [x] My change requires a change to the documentation.
- [x] I have updated the documentation accordingly.
- [x] I have read the CONTRIBUTING document.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
This seems like a fairly sensible proposal, but no activity from any of the core contributors in over half a year. Is this project still active?
@JohnPaulHarold I was told by the devs that they are moving to lrud-spatial. As far as I know, this project is effectively deprecated.
@JohnPaulHarold I was told by the devs that they are moving to lrud-spatial. As far as I know, this project is effectively deprecated.
@EwanRoycroft Thank you for the reply. I can't access that repo, probably because I'm not in the BBC github org, but I'll try and keep an eye out for any mention of it releasing to the public.