Skip to content

Conversation

@Sereza7
Copy link
Contributor

@Sereza7 Sereza7 commented Oct 18, 2024

Jira URL

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

Changes

Description

  • Replaced the FocusCatcher artificial input.
  • Updated the style of the gallery to use css grid instead of hackish solutions all around.
  • Improved accessibility by changing the div interactive controllers with buttons.
  • Improved consistency of the UI by adding standard round corners to the component.

Clarifications

  • The solution picked had to go around a layout issue with the picture overflowing off the grid when wrapped and in full screen See the comment for more details on this issue.

Screenshots & Video

Video demo:

2024-10-18.13-54-58.mp4

The gallery controls are tested both with the mouse and the keyboard.

Before:
image
After:
image

I tried to keep the visuals as close as possible as what was here before. The only differences I can spot are:

  • Round corners
  • Slightly more space between the side of the component and the previous/next buttons. This happens because of the default padding that was added when transforming this element in a button. IMO this change is not a problem.

Executed Tests

Manual tests: see above + tests with different screen sizes.
Built changes with mvn clean install -f xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war -Pquality and tested mvn clean install -f xwiki-platform-core/xwiki-platform-office/xwiki-platform-office-test/xwiki-platform-office-test-docker -Pdocker -Dxwiki.test.ui.wcag=true. The WCAG violations reported did not highlight any issue with the gallery anymore.

Expected merging strategy

  • Prefers squash: Yes
  • Backport on branches:
    • None

* Replaced the FocusCatcher artificial input with a semantically better span.
* Updated the style of the gallery to use css grid instead of hackish solutions all around.
* Improved accessibility by changing the div interactive controllers with buttons.

TODO: Check further the half screen large picture maximized gallery behavior bug and find a fix for it.
* Fixed the full screen display vertical overflow issue.
Copy link
Member

@mflorea mflorea left a comment

Choose a reason for hiding this comment

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

Looks good with some minor (code formatting) comments.

Comment on lines 34 to 39
/* Instead of an arbitrary element to catch focus, we use the index.
* This index already stores the current image state, might as well be responsible for providing quick controls and
* explanations about these quick controls.
* Note that wrapping the image in an interactive container to handle this would have been a good solution too.
* However, this wrapping caused the image to overflow the CSS grid vertically when in maximized mode.
* Technically I couldn't find a CSS solution to prevent this, so I decided to make do without wrapping. */
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
/* Instead of an arbitrary element to catch focus, we use the index.
* This index already stores the current image state, might as well be responsible for providing quick controls and
* explanations about these quick controls.
* Note that wrapping the image in an interactive container to handle this would have been a good solution too.
* However, this wrapping caused the image to overflow the CSS grid vertically when in maximized mode.
* Technically I couldn't find a CSS solution to prevent this, so I decided to make do without wrapping. */
// Instead of an arbitrary element to catch focus, we use the index.
// This index already stores the current image state, might as well be responsible for providing quick controls and
// explanations about these quick controls.
// Note that wrapping the image in an interactive container to handle this would have been a good solution too.
// However, this wrapping caused the image to overflow the CSS grid vertically when in maximized mode.
// Technically I couldn't find a CSS solution to prevent this, so I decided to make do without wrapping.

Multiline comments are normally used to document functions (methods) and classes (or types in general).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't have a code style for javascript AFAIR. I assumed it'd be best to use the same comment style as the one we use for CSS. It would be interesting to keep trace of this rule so that new contributors won't make the same mistake. I created the draft doc https://dev.xwiki.org/xwiki/bin/view/Drafts/Javascript%20Code%20Style/ for now.

Reference of where we can already see this codestyle in action

Copy link
Member

Choose a reason for hiding this comment

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

I assumed it'd be best to use the same comment style as the one we use for CSS.

JavaScript is a programming language, unlike CSS, so I don't think it makes sense to look at CSS code styles for defaults. The default should be the Java code style IMO.

* Comment formatting

Co-authored-by: Marius Dumitru Florea <[email protected]>
@Sereza7
Copy link
Contributor Author

Sereza7 commented Dec 10, 2024

The comments on this PR are addressed and it is ready for further review or a merge.

@mflorea mflorea merged commit 4241c3c into xwiki:master Dec 10, 2024
1 check passed
mflorea pushed a commit that referenced this pull request Dec 10, 2024
* Replaced the FocusCatcher artificial input with a semantically better span.
* Updated the style of the gallery to use css grid instead of hackish solutions all around.
* Improved accessibility by changing the div interactive controllers with buttons.
* Fixed the full screen display vertical overflow issue.

(cherry picked from commit 4241c3c)
earzur pushed a commit to earzur/xwiki-platform that referenced this pull request Sep 8, 2025
* Replaced the FocusCatcher artificial input with a semantically better span.
* Updated the style of the gallery to use css grid instead of hackish solutions all around.
* Improved accessibility by changing the div interactive controllers with buttons.
* Fixed the full screen display vertical overflow issue.
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