Make WordPress Core

Opened 8 months ago

Closed 4 months ago

#63126 closed enhancement (fixed)

Theme preview model and Media library model having issues with Shift/Ctrl + Shift next and previous arrows.

Reported by: praful2111's profile praful2111 Owned by: joedolson's profile joedolson
Milestone: 6.9 Priority: normal
Severity: normal Version: 6.7.2
Component: Themes Keywords: has-patch has-test-info commit
Focuses: accessibility Cc:

Description

When we open the theme preview model and try to select text using the Shift/Ctrl+Shift with a left and right arrow then the theme modal switches the theme instead of the selecting text.

Screen recording - https://www.awesomescreenshot.com/video/37791980

Attachments (3)

63126.patch (903 bytes) - added by praful2111 8 months ago.
Patch added
63126.2.patch (903 bytes) - added by praful2111 8 months ago.
Patch added
63126-theme-and-edit-attachments.patch (1.5 KB) - added by hiteshtalpada 8 months ago.
Added theme and media library model patch

Download all attachments as: .zip

Change History (20)

@praful2111
8 months ago

Patch added

@praful2111
8 months ago

Patch added

#1 @praful2111
8 months ago

  • Keywords has-patch added; needs-patch removed

#3 @hiteshtalpada
8 months ago

  • Keywords has-testing-info added

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://core.trac.wordpress.org/attachment/ticket/63126/63126.patch

Environment

  • WordPress: 6.8-beta3-60042-src
  • PHP: 8.2.25
  • Server: nginx/1.27.2
  • Database: mysqli (Server: 8.4.2 / Client: mysqlnd 8.2.25)
  • Browser: Chrome 134.0.0.0
  • OS: Linux
  • Theme: Twenty Twenty-Five 1.1
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

Actual Results

  1. ✅ Issue resolved with patch.

#4 @joemcgill
8 months ago

  • Milestone changed from Awaiting Review to 6.9

Hi @praful2111. Thanks for the report and for including a patch!

I can reproduce the issue and confirmed that this was existing behavior in 6.7. Given that we're so close to the release deadline for 6.8, I'm adding this to the 6.9 milestone for consideration.

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


8 months ago

#6 @joedolson
8 months ago

  • Owner set to joedolson
  • Status changed from new to accepted

The same issue occurs in the media library modal. We can probably resolve both in this ticket; but if it proves to be a significantly different solution, we should open a separate ticket.

#7 @hiteshtalpada
8 months ago

  • Summary changed from Theme preview model having issues with Shift/Ctrl + Shift next and previous arrows. to Theme preview model and Media library model having issues with Shift/Ctrl + Shift next and previous arrows.

Hi @joedolson Thanks for pointing that out!

I've created a patch that should resolve the issue in the media library model.

@hiteshtalpada
8 months ago

Added theme and media library model patch

#8 @wordpressdotorg
6 months ago

  • Keywords has-test-info added; has-testing-info removed

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


6 months ago

#10 in reply to: ↑ description @nazmul111
6 months ago

Replying to praful2111:

Screen recording - https://www.awesomescreenshot.com/video/37791980

screen recording not found. You are requested to check.

This ticket was mentioned in Slack in #core-test by boniu91. View the logs.


6 months ago

#12 @sandeepdahiya
5 months ago

  • Keywords needs-unit-tests added

Bug Reproduction and Test Report

Description

✅ This report validates that the bug exists as reported and the indicated patch works as expected.

Patch tested: 63126-theme-and-edit-attachments.patch

Environment

  • WordPress: 6.9-alpha-60093-src
  • PHP: 8.2.28
  • Server: nginx/1.27.5
  • Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
  • Browser: Firefox 139.0
  • OS: Windows 10/11
  • Theme: Twenty Twenty-Five 1.2
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

Actual Results

  1. 🐞 Bug reproduction: Log in to the WordPress dashboard, go to Appearance → Themes, click on any theme, and try selecting text using the mouse. Then use (Shift + →) or (Ctrl + Shift + →).You’ll notice that instead of selecting the text, WordPress navigates to the next theme preview. The same issue occurs in the Media Library as well.
  1. ✅ Test results: Issue resolved with patch. (Shift + →) or (Ctrl + Shift + →) selects the next instead of moving to the next item. and pressing → key only takes you to the next item.

Additional Notes

This ticket was mentioned in PR #9014 on WordPress/wordpress-develop by @abcd95.


5 months ago
#13

This PR prevents theme preview and media library modals from interfering with text selection keyboard shortcuts.

When using Shift+Arrow or Ctrl+Shift+Arrow to select text in modal descriptions, the modal would capture the arrow keys and navigate to next/previous items instead of allowing text selection. This unexpected behavior prevented users from efficiently editing text.

Added tests to verify the logic to ignore arrow key events when Shift or Ctrl+Shift modifiers are pressed, allowing default text selection behavior.

Follows Patch: https://core.trac.wordpress.org/attachment/ticket/63126/63126-theme-and-edit-attachments.patch

#14 @abcd95
4 months ago

  • Keywords needs-unit-tests removed

@joedolson commented on PR #9014:


4 months ago
#15

I briefly considered whether the tests should use event.code or event.key instead of the deprecated event.keyCode, but decided that it makes more sense to keep the tests using the same references used in the actual code, and changing those over should be a separate task.

#16 @joedolson
4 months ago

  • Keywords commit added

#17 @joedolson
4 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 60516:

General: Prevent Media & Theme modals from events on modified arrow keys.

Change the left and right arrow key navigation used in the Theme and Media modal interfaces so the events don't fire when shift or ctrl are also pressed.

Includes tests.

Props praful2111, hiteshtalpada, joemcgill, sandeepdahiya, abcd95, joedolson.
Fixes #63126.

Note: See TracTickets for help on using tickets.