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

Changed markup when using optgroup element #42

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

lucascumsille
Copy link
Contributor

Instead of using the pseudo element to display the title of a optgroup, now they will be wrapped on a fieldset with a legend. The legend will have the text from the label atrribute from the optgroup.

It's also possible to change the class names for the fieldset and legend, by using these settings: menuFieldsetHTML and menuFieldsetLegendHTML.

Screenshot 2024-01-15 at 14 10 36

@lucascumsille lucascumsille requested a review from dracos January 15, 2024 14:25
Copy link
Member

@dracos dracos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions, let me know what you think. Also as mentioned elsewhere we'll need to make the up/down changes here (in e.g. the upDown function).

src/jquery.multi-select.js Outdated Show resolved Hide resolved
demo/index.html Outdated Show resolved Hide resolved
src/jquery.multi-select.min.js Outdated Show resolved Hide resolved
src/example-styles.css Outdated Show resolved Hide resolved
src/example-styles.css Show resolved Hide resolved
src/jquery.multi-select.js Outdated Show resolved Hide resolved
@lucascumsille
Copy link
Contributor Author

@dracos Thanks for the feedback =), sorry I had a couple of extras from an experiment I was doing a couple of weeks ago. I added some fixups, that fixed all the issues above. I tried to make the up and down keys to work when using fieldset, but it didn't work at the end.

@dracos
Copy link
Member

dracos commented Jan 22, 2024

@lucascumsille I've pushed a commit that hopefully gets up/down working as before if you'd like to take a look. I've also fixed the tests.

@lucascumsille
Copy link
Contributor Author

@dracos That's perfect is working for me. I tried it on Voiceover, and it works slightly different than the one we used to have, where on each option it would read = "Group title + option name" Example "Flavour Vanilla", now it gives the name of the group when you are in the first option of the group, which is exactly what happens with GOVUK and by default.

If we wanted to keep the current behaviour we could include an aria-label that reads "Flavour Vanilla", but I'm not sure if it's unnecessary, because screenreader users are already used to the default. At the same time I liked the fact that "Flavour Vanilla" provides context without the need of having good memory, but it can be a pain with long lists or fieldsets with long names.

Let me know what you think, otherwise I can just merge to master.

@dracos
Copy link
Member

dracos commented Jan 23, 2024

I think going with the default fieldset behaviour is probably more consistent, yeah - the category list on FMS map filter can be quite long, but OTOH will have a few fieldsets in it, but hopefully will be clear.

@lucascumsille
Copy link
Contributor Author

@dracos Sounds good, let's keep it like that. Should I merge it master?

@dracos
Copy link
Member

dracos commented Jan 23, 2024

yeah, go for it, up to you if you want to merge the two commits as one or keep it as it is

Instead of using the pseudo element to display the title of a optgroup,
now they will be wrapped on a fieldset with a legend. The legend will
have the text from the label attribute from the optgroup.

It's also possible to change the class names for the fielset and legend,
by using these settings: menuFieldsetHTML and menuFieldsetLegendHTML.

Adapt up/down code to work with fieldsets.
@lucascumsille lucascumsille merged commit 8b35fcd into master Jan 23, 2024
2 checks passed
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.

2 participants