Bug 277943 - regression in khtml forms when using enter key to select item from completion list
Summary: regression in khtml forms when using enter key to select item from completion...
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: khtml forms (show other bugs)
Version: 4.7.0
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-17 11:32 UTC by Andrea Iacovitti
Modified: 2011-08-05 12:36 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.7.1


Attachments
klineedit patch (888 bytes, patch)
2011-08-03 12:28 UTC, Andrea Iacovitti
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrea Iacovitti 2011-07-17 11:32:21 UTC
Version:           4.7.0
OS:                Linux

Have an html form input text field, type in some chars making completion box
appears. Focus by using arrows keys any of the suggested values in the
completion list then press enter key to select one.

Reproducible: Always


Actual Results:  
The form is immediately submitted

Expected Results:  
The input text field must be filled with the selected item and the form must not be automatically submitted

I did some tests and i verified this is a regression introduced by kdelibs commit 2ea274cdc660496c5cc9d591f5a5269c24c874aa
Comment 1 Andrea Iacovitti 2011-07-18 18:23:35 UTC
Possible fix:
--- render_form.cpp~
+++ render_form.cpp
@@ -1081,7 +1081,7 @@
     // don't submit the form when return was pressed in a completion-popup
     KCompletionBox *box = widget()->completionBox(false);
 
-    if ( box && box->isVisible() && box->currentRow() != -1 ) {
+    if ( box && box->currentRow() != -1 ) {
       box->hide();
       return;
     }

It seems that newer klineedit first hides completionBox and afterwards emits returnPressed. This results in box->isVisible() to be always false in RenderLineEdit::slotReturnPressed() in render_form.cpp, then form is immediately submitted.
With the above patch if completion box appears while editing input text but you ignore it and press enter the form is immediately submitted (like e.g Firefox do)
Comment 2 Chris Samuel 2011-07-22 10:51:39 UTC
This also affects KDE 4.6.5, in my case on Kubuntu 11.04.
Comment 3 Andrea Iacovitti 2011-08-03 12:02:34 UTC
(In reply to comment #2)
> This also affects KDE 4.6.5, in my case on Kubuntu 11.04.
Sorry, can't confirm...
Comment 4 Chris Samuel 2011-08-03 12:25:54 UTC
(In reply to comment #3)

> (In reply to comment #2)
> > This also affects KDE 4.6.5, in my case on Kubuntu 11.04.
> Sorry, can't confirm...

My version information from Konqueror (64-bit) says:

Konqueror
Version 4.6.5 (4.6.5)
Using KDE Development Platform 4.6.5 (4.6.5)

If I hit a character to bring up some entries for a form, select one then hit enter it completes correctly, then when I hit TAB to go to the next part of the form only the bit I had typed myself remains in the box.
Comment 5 Andrea Iacovitti 2011-08-03 12:28:54 UTC
Created attachment 62503 [details]
klineedit patch

Instead of modify khtml code (comment #1), try to restore klineedit behavior as before commit 2ea274cd.
Comment 6 Andrea Iacovitti 2011-08-03 12:49:33 UTC
(In reply to comment #4)
> If I hit a character to bring up some entries for a form, select one then hit
> enter it completes correctly, then when I hit TAB to go to the next part of the
> form only the bit I had typed myself remains in the box.

What you described has nothing to do with this ticket, isn't it?
There is an already reported bug for that (#277457)
Comment 7 Andrea Iacovitti 2011-08-04 15:26:50 UTC
Git commit 0f9004209464f2bdfbef9031836ed72c63f52887 by Andrea Iacovitti.
Committed on 04/08/2011 at 16:54.
Pushed by aiacovitti into branch 'KDE/4.7'.

Restore klineedit behavior as before kdelibs commit 2ea274cd.
Fixed khtml form regression where choosing an item in completion box
by pressing Enter key immediately submits the form instead of just
filling the input text field.

BUG: 277943
FIXED-IN: 4.7.1

M  +7    -4    kdeui/widgets/klineedit.cpp

http://commits.kde.org/kdelibs/0f9004209464f2bdfbef9031836ed72c63f52887
Comment 8 Andrea Iacovitti 2011-08-04 17:05:43 UTC
Git commit b57c0173480338ef67fd17d573278f5e596bf4fc by Andrea Iacovitti.
Committed on 04/08/2011 at 16:54.
Pushed by aiacovitti into branch 'master'.

Restore klineedit behavior as before kdelibs commit 2ea274cd.
Fixed khtml form regression where choosing an item in completion box
by pressing Enter key immediately submits the form instead of just
filling the input text field.

BUG: 277943
FIXED-IN: 4.7.1
(cherry picked from commit 0f9004209464f2bdfbef9031836ed72c63f52887)

M  +7    -4    kdeui/widgets/klineedit.cpp

http://commits.kde.org/kdelibs/b57c0173480338ef67fd17d573278f5e596bf4fc
Comment 9 Chris Samuel 2011-08-05 12:36:43 UTC
(In reply to comment #6)

> What you described has nothing to do with this ticket, isn't it?
> There is an already reported bug for that (#277457)

Apologies, I must have misread the original report! :-(