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

Dependent options not always loaded on first change #93

Open
gesinn-it-wam opened this issue Apr 29, 2022 · 1 comment
Open

Dependent options not always loaded on first change #93

gesinn-it-wam opened this issue Apr 29, 2022 · 1 comment
Labels
Milestone

Comments

@gesinn-it-wam
Copy link
Contributor

gesinn-it-wam commented Apr 29, 2022

Setup

  • MW version: 1.35.5
  • SMW version: 4.0.0
  • SFS version: 4.0.0-beta
  • PF version: 5.3.4

Issue

After selecting a PF element from input type combobox the options for a dependent SFS element are not always loaded on first change; instead you have to select a different element first and another change will fill the options

@gesinn-it-gea gesinn-it-gea added this to the 4.0.0 milestone Apr 29, 2022
@gesinn-it-wam
Copy link
Contributor Author

This seems to be depending on how you select the value. The combobox is based on the OOUI ComboBoxInputWidget which seems to fire a change event after selecting an option only if there has been typed into the corresponding input field; that is, using only the arrow keys or the mouse to select an option does not fire the change event. (And therefore SFS is not informed to update the options.)

One can try this here: https://doc.wikimedia.org/oojs-ui/master/demos/?page=widgets&theme=wikimediaui&direction=ltr&platform=desktop#demo-section-comboBox

Execute the following code in the JavaScript console

$('body').change(event => console.log({change : event.target, val: $(event.target).val()}));
$('body').focusout(event => console.log({focusout : event.target, val: $(event.target).val()}));

and watch the output:

  • Using only the mouse or the arrow keys in the select process, after leaving the combobox only the focusout is fired
  • Having typed anything to the input field before selecting, also the change event is fired

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants