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

XWIKI-22339: Icon picker is not keyboard operable #3800

Merged
merged 3 commits into from
Jan 16, 2025

Conversation

Sereza7
Copy link
Contributor

@Sereza7 Sereza7 commented Jan 14, 2025

Jira URL

https://jira.xwiki.org/browse/XWIKI-22339

Changes

Description

  • Updated the type of the icon buttons to be actual buttons and not disguised divs.
  • Added word break indicators in the icon names, for cleaner breaks on long iconNames.
  • Moved the DOM representation of the picker right after the input.
  • Added an escape listener on the picker content to easily get out of it.
  • Updated style to avoid having too big of a change with the new DOM.
  • Improved style for long iconNames, which were poorly supported before.

Screenshots & Video

Video demo of the iconpicker with the changes proposed in this PR:

2025-01-14.18-03-08.mp4

Executed Tests

Successfully passed mvn clean install -f xwiki-platform-core/xwiki-platform-icon/ -Pquality,integration-tests,docker. Ran mvn xar:format to make sure every addition was XML escaped.

Expected merging strategy

* Updated the type of the icon buttons to be actual buttons and not disguised divs.
* Added word break indicators in the icon names, for cleaner breaks on long iconNames.
* Moved the DOM representation of the picker right after the input.
* Added an escape listener on the picker content to easily get out of it.
* Updated style to avoid having too big of a change with the new DOM.
* Improved style for long iconNames, which were poorly supported before.
@@ -243,14 +243,21 @@ require(['jquery', 'xwiki-icon-picker'], function($) {
for (var i=0; i < iconTheme.length; ++i) {
// Display the icon
if (selectedIconName === '' || iconTheme[i].name.includes(selectedIconName)) {
var displayer = $(document.createElement('div'));
var displayer = $(document.createElement('button'));
Copy link
Member

Choose a reason for hiding this comment

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

any reason to not use $('<button>') (see https://api.jquery.com/jQuery/#jQuery2)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really, just keeping the changes minimal. AFAICS all the elements created in this file use this pattern. I figured keeping this pattern is the safest choice (though I doubt it would change anything in any situation).

Should I replace all the instantiations with the pattern you proposed?

No changes applied yet.

Copy link
Member

Choose a reason for hiding this comment

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

Should I replace all the instantiations with the pattern you proposed?

Probably not, leave it like this.

Copy link
Member

@surli surli left a comment

Choose a reason for hiding this comment

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

LGTM except the minor comment I made on code style.

@surli surli merged commit 818bc25 into xwiki:master Jan 16, 2025
surli pushed a commit that referenced this pull request Jan 16, 2025
* XWIKI-22339: Icon picker is not keyboard operable
* Updated the type of the icon buttons to be actual buttons and not disguised divs.
* Added word break indicators in the icon names, for cleaner breaks on long iconNames.
* Moved the DOM representation of the picker right after the input.
* Added an escape listener on the picker content to easily get out of it.
* Updated style to avoid having too big of a change with the new DOM.
* Improved style for long iconNames, which were poorly supported before.
* Escaped changes
* Fixed typo

(cherry picked from commit 818bc25)
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