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

Unexpected behaviour for numerical input field in firefox #314

Open
gpetretto opened this issue Feb 17, 2023 · 0 comments
Open

Unexpected behaviour for numerical input field in firefox #314

gpetretto opened this issue Feb 17, 2023 · 0 comments

Comments

@gpetretto
Copy link
Collaborator

I am opening this issue to point out an unexpected way of handling the numerical field inputs generated by the crystal toolkit in firefox. I am not sure if this should be considered a bug, since it does not depend entirely on the crystal toolkit, so my aim is mostly to highlight the existence and the cause of this issue, in case someone else experiences it.

As you can see below, when acting on the field with the arrows the changes are not taken into account, while changing the field by typing the numbers directly works correctly

input_cell_fireworks.mp4

As far as I have tested, this only happens in firefox, both on MacOS and windows. With Chrome, edge and safari everything seems to work as expected. I demonstrated this on a crystal toolkit example, but the same happens for other fields and on the materials project website as well.

The reason seems to be related to the debounce option set in the get_numerical_input method of the MPComponent

It seems that in firefox using the arrows to set the input value does not result in the field getting the focus and thus the changes are then ignored (see https://bugzilla.mozilla.org/show_bug.cgi?id=1012818 for example). In other browsers the field instead seems to get the focus when using the arrow buttons, so there is no issue there.

In case this needs to be fixed, setting debounce to False would probably be a bad idea, since this might trigger unexpected callbacks in some of the components. An option would be to remove the type="number" option. This would avoid tricking the user by removing the arrows buttons entirely.

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

No branches or pull requests

1 participant