Ticket #4269 (closed Bug: fixed)

Opened 5 years ago

Last modified 5 years ago

"Esc" and "Enter" keystrokes are not handled when a dialogue box is opened which causes the form post automatically

Reported by: Pranav Owned by: garry.yao
Priority: Normal Milestone: CKEditor 3.1
Component: General Version:
Keywords: Oracle Review+ Cc: Pranav, Senthil

Description

Open a dialogue box using Image or Link controls and press "Enter" or "Esc". You will observe that the form post is happening automatically. This is affecting our application functionality. Please give high priority to get it fixed.

Attachments

replacebycode.html (2.5 KB) - added by Pranav 5 years ago.
Sample HTML File
4269.patch (3.1 KB) - added by tobiasz.cudnik 5 years ago.
4269_2.patch (2.1 KB) - added by tobiasz.cudnik 5 years ago.
replacebycode_enter.html (2.9 KB) - added by Senthil 5 years ago.
4269_3.patch (1.6 KB) - added by garry.yao 5 years ago.
4269_4.patch (2.2 KB) - added by garry.yao 5 years ago.

Change History

comment:1 Changed 5 years ago by fredck

  • Cc Pranav, Senthil added; Pranav Senthil removed
  • Milestone changed from CKEditor 3.0 to CKEditor 3.1

comment:2 follow-up: ↓ 3 Changed 5 years ago by tobiasz.cudnik

  • Keywords Pending added
  • Status changed from new to assigned
  • Owner set to tobiasz.cudnik

What browser is affected by this issue ? Checked FF 3.5 and couldn't reproduce it. Also it's strange that form post could be triggered by ESC key...

To be clear, we're talking about form in which CKEditor is nested (or at least textarea which it replaces). Not form inside dialog box.

comment:3 in reply to: ↑ 2 Changed 5 years ago by Pranav

Replying to tobiasz.cudnik:

What browser is affected by this issue ? Checked FF 3.5 and couldn't reproduce it. Also it's strange that form post could be triggered by ESC key...

To be clear, we're talking about form in which CKEditor is nested (or at least textarea which it replaces). Not form inside dialog box.

Both IE and Firefox are afected by this issue. "Enter" keystroke causes form post in IE as well as Firefox. "Esc" keystroke causes form post in Firefox only. IE is working fine for "Esc" keystroke. I am attaching a sample html file to reproduce the issue.

Changed 5 years ago by Pranav

Sample HTML File

comment:4 Changed 5 years ago by tobiasz.cudnik

  • Keywords Confirmed added; Pending removed

comment:5 Changed 5 years ago by tobiasz.cudnik

  • Keywords Review? added

Provided example made things clear, thank you.

Attahced patch prevents ESC and ENTER keys from bubbling up (outside the dialog) in all 3 type of key events, which works with attached sample.

Changed 5 years ago by tobiasz.cudnik

comment:6 Changed 5 years ago by garry.yao

  • Keywords Pending added; Review? removed

Ticket Test added at : http://ckeditor.t/tt/4269/4269.html.

comment:7 Changed 5 years ago by garry.yao

I don't see this as an bug from the editor, instead I see a problem of the events handling at the provided sample page:

<body onkeypress="return submitenter(event)">

The editor dialog key events is naturally part of the host page and should be bubbled up, it's not a good option for us to prevent this default behavior only because of the your above way ( others may argue that they need this event ).

comment:8 Changed 5 years ago by fredck

  • Keywords Review? added; Pending removed

I'm ok to stop these two specific keys. It's not a big issue, after all ours is an indepent application. The only important thing here is being sure that elements inside the dialog are receiving the event, as we may have fields that need these keys to perform some action. We don't need to care about things outside the dialog instead.

Changed 5 years ago by tobiasz.cudnik

comment:9 Changed 5 years ago by tobiasz.cudnik

There was a little issue with Enter key in first patch, which was able to bubble up if focus was outside text fields.

Key events are canceled after dialog's key system, so it's no change for it (dialog key system). All key handlers are attached to element above dialog holder div, which is body.

comment:10 Changed 5 years ago by garry.yao

  • Keywords Review+ added; Review? removed

comment:11 Changed 5 years ago by tobiasz.cudnik

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

Fixed with [4165].

comment:12 Changed 5 years ago by Senthil

  • Status changed from closed to reopened
  • Keywords Confirmed Review+ removed
  • Resolution fixed deleted

We have verified this issue in the patch "4269_2.patch" and nightly build as well but we still see the form post issue after pressing the enter or escape keys on top of any ckeditor dialogs(Ex: Table control). I have attached the sample html file(replacebycode_enter.html) here, please copy the file into the ckeditor\_sample folder and try again. This is really a critical issue, Please provide the appropriate priority.

Changed 5 years ago by Senthil

comment:13 Changed 5 years ago by Senthil

Issue can be reproduced on IE7,8 & FF3.5

Changed 5 years ago by garry.yao

comment:14 Changed 5 years ago by garry.yao

  • Keywords Review? added

Senthil's TC has failed because it contains such kind of "dead angle" event handler which turn out to be always triggered before ours.

document.addEventListener( 'keydown', function(){...}, false );

It's a fault for our dialog key handling system to consume events on the host document, we could safely have them on the dialog element instead.
Ticket Test updated.

comment:15 Changed 5 years ago by garry.yao

  • Priority changed from High to Normal

The priority field is an internal flag used by developers, please avoid using it.

comment:16 Changed 5 years ago by garry.yao

  • Status changed from reopened to new
  • Owner changed from tobiasz.cudnik to garry.yao

comment:17 Changed 5 years ago by fredck

  • Keywords Review- added; Review? removed

It doesn't fix the issue. I've just opened the table dialog and hit ENTER... the form gets posted.

Changed 5 years ago by garry.yao

comment:18 Changed 5 years ago by garry.yao

  • Keywords Review? added; Review- removed
  • Status changed from new to assigned

Precisely, previous patch only doesn't work for 'keyup' event of 'enter' key in Firefox: Enter key hiding the dialog ( make the element invisible ) which will potentially drop any other event listeners ( the bubbling locker )in the queue.

comment:19 Changed 5 years ago by fredck

  • Keywords Review+ added; Review? removed

comment:20 Changed 5 years ago by garry.yao

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

Fixed with [4584].

Note: See TracTickets for help on using tickets.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy