davidtheclark / davidtheclark/focus-group

onFocus callback

Open
#9 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
44
Forks
9
PR merge metrics
No merged PRs in 30d

Description

How do you feel about an `onFocus` callback? So if you have an element that can't receive focus you can add a class yourself or handle the state in something like React and apply a style. I'm trying to build a combobox right now and need to have a fake focus group so the input can remain focused, but still allow choosing a result. Thoughts? I can put together a PR if you like the idea. Maybe something like this?

```
onFocus: options.onFocus || function (member) {
focusNode(member.node)
}
```

Then it would be the user's responsibility to handle focusing the element however they wanted.

_edit_

Realized this can't be solved with just a callback. I'm guessing another option like `groupNode` would be required to determine what the focus group is. Any ideas on that?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.