WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#28279 closed defect (bug) (fixed)

DFW: escape key broken

Reported by: iseulde Owned by: SergeyBiryukov
Milestone: 4.0 Priority: normal
Severity: normal Version:
Component: Editor Keywords:
Focuses: accessibility Cc:

Description

Two things are broken:

  1. When the content is focussed (place your cursor in the content), pressing esc doesn't work. Adding a listener to the TinyMCE editor solves this.
  2. When switching tabs in the browser (or removing focus from the document some other way), pressing esc doesn't work because the document isn't focussed. Adding a listener to the window instead solves this.

You can't namespace events outside jQuery and keeping it in one place is useless, so I removed it.
Used keyup rather than keydown because that will only fire once.

Attachments (1)

esc.patch (1.3 KB) - added by iseulde 7 years ago.

Download all attachments as: .zip

Change History (11)

@iseulde
7 years ago

#1 @iseulde
7 years ago

  • Keywords has-patch added

#2 @SergeyBiryukov
7 years ago

  • Milestone changed from Awaiting Review to 4.0

#3 @SergeyBiryukov
7 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 28443:

DFW: Properly handle Esc key when the content is focused or when switching browser tabs.

props avryl.
fixes #28279.

#4 @azaozz
7 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

This introduced a regression: when a modal is open (wpLink or media), Esc closes both the modal and DFW. Also, why remove the "namespace" from the jQuery event? This should probably go into the coding standards: all jQuery events *must* be namespaced. That adds another level of interoperability.

#5 follow-up: @iseulde
7 years ago

This introduced a regression: when a modal is open (wpLink or media), Esc closes both the modal and DFW.

It looks like this also happens in 3.9. But let's fix it. :)

Also, why remove the "namespace" from the jQuery event? This should probably go into the coding standards: all jQuery events *must* be namespaced. That adds another level of interoperability.

Oh, sorry. So it doesn't matter that the other event can't be namespaced?

#6 in reply to: ↑ 5 @azaozz
7 years ago

Replying to avryl:

It looks like this also happens in 3.9. But let's fix it. :)

Seems to work well without that commit. At least for the wpLink and media modals.

So it doesn't matter that the other event can't be namespaced?

Well, TinyMCE is different. Doesn't mean we should treat jQuery the same :)

In this case it's most likely the event may need unbinding outside the editor to tweak closing modals.

#7 @iseulde
7 years ago

  • Keywords needs-patch added; has-patch removed

Seems to work well without that commit. At least for the wpLink and media modals.

Weird, in 3.9 I enable DFW, open the media modal, press esc and everything closes.

#8 @azaozz
7 years ago

In [28455]:

DFW: fix closing only the wpLink or media modal when pressing Esc.

This ticket was mentioned in IRC in #wordpress-ui by accessiblejoe. View the logs.


7 years ago

#10 @SergeyBiryukov
7 years ago

  • Keywords needs-patch removed
  • Resolution set to fixed
  • Status changed from reopened to closed

Looks like this was fixed in [28455].

Note: See TracTickets for help on using tickets.