Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GUI] allow any element to be focused #15232

Merged
merged 1 commit into from
Jun 27, 2024
Merged

Conversation

RaananW
Copy link
Member

@RaananW RaananW commented Jun 26, 2024

This PR adds a few parameters to control (the base class of all GUI elements):

  1. tabIndex - works similar to tabIndex in HTML. Defaults to -1, meaning - not focusable
  2. focusedColor - the (border) color of the element if it is focussed using tab
  3. onEnterPressedObservable - works similat to onPointerClicked - what happens when enter is pressed on a focused element.

Any control has onBlur and onFocus callbacks, and observables to catch these events.

The ADT has a flag that can turn off the entire behavior (disableTabNavigation). It is on per default, but since tabIndex is -1 per default, it shouldn't change anything.

There is a slight typing change, but it shouldn't be a breaking change, as we moved from an interface to a class that holds the entire interface (and actually implements it).
The only real breaking change is the onFocusObservable in virtual keyboard, which is not often used.

Test with this playground - #KKA6L4#16

@bjsplat
Copy link
Collaborator

bjsplat commented Jun 26, 2024

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Jun 26, 2024

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Jun 26, 2024

@bjsplat
Copy link
Collaborator

bjsplat commented Jun 26, 2024

@bjsplat
Copy link
Collaborator

bjsplat commented Jun 26, 2024

@RaananW RaananW enabled auto-merge (squash) June 27, 2024 09:12
@RaananW RaananW merged commit 93d3b09 into BabylonJS:master Jun 27, 2024
11 of 12 checks passed
@RaananW RaananW deleted the focusOnTab branch June 27, 2024 10:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants