Opened 9 years ago
Closed 9 years ago
#34716 closed defect (bug) (fixed)
Using wplink (wp_editor) on front end is triggering a js error due to unsatisfied dependency
Reported by: | imath | Owned by: | azaozz |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | normal | Version: | 4.3 |
Component: | Editor | Keywords: | needs-patch |
Focuses: | accessibility, javascript | Cc: |
Description
wplink should include jquery-ui-core
in its dependencies as it uses it > $.ui
When using the wp_editor in front end, if you click on the link button, and once the window is opened, if you try to type some text for the link's text, you get :
Uncaught TypeError: Cannot read property 'keyCode' of undefined
I think that's because $.ui
is not defined, because the jquery-ui-core
is not enqueued on front-end (it's enqueued in the post edit Administration screen).
Using the attached patch is fixing the issue for me.
Attachments (2)
Change History (9)
#2
follow-up:
↓ 5
@
9 years ago
- Owner set to azaozz
- Status changed from new to reviewing
- Version trunk deleted
#3
@
9 years ago
- Focuses accessibility added
Be sure to be logged out to reproduce the bug. Also, this impacts accessibility since tabbing is no more constrained inside the link modal etc.
#4
@
9 years ago
- Version set to 4.3
Looking back at this, wondering why jQuery UI is used in the first place. Maybe some historical need for key codes normalization but as today I think event.keyCode
is safe to use?
See attached patch, getting rid of $.ui
so there's no need to set jquery-ui-core
as dependency.
Any thoughts?
#5
in reply to:
↑ 2
@
9 years ago
- Milestone changed from Awaiting Review to 4.4
Replying to DrewAPicture:
Replying to afercia:
Long time ago wplink was using UI dialog. Seems $.ui.keyCode
was never removed after converting it to "plain" JS.
Thinking the better way to fix this is to stop using $.ui.keyCode
as in 34716.2.patch. There is a (very) small chance of version collision if we enqueue jquery-ui-core on the front.
@azaozz Mind taking a look? Based on snooping around in blame, this might've been around for a while now.