Bug 189010 - [Datalist] Pressing enter without a selected option shouldn't change the input
Summary: [Datalist] Pressing enter without a selected option shouldn't change the input
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: WebKit Nightly Build
Hardware: Mac Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-08-27 14:58 PDT by Aditya Keerthi
Modified: 2018-08-28 22:35 PDT (History)
6 users (show)

See Also:


Attachments
Patch (6.18 KB, patch)
2018-08-27 15:33 PDT, Aditya Keerthi
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aditya Keerthi 2018-08-27 14:58:24 PDT
Currently, the value of an input field gets cleared if there is no selected datalist suggestion when the enter key is pressed. The correct behavior is to leave the value of the input as-is.
Comment 1 Aditya Keerthi 2018-08-27 15:33:03 PDT
Created attachment 348216 [details]
Patch
Comment 2 WebKit Commit Bot 2018-08-28 10:03:03 PDT
Comment on attachment 348216 [details]
Patch

Clearing flags on attachment: 348216

Committed r235427: <https://trac.webkit.org/changeset/235427>
Comment 3 WebKit Commit Bot 2018-08-28 10:03:05 PDT
All reviewed patches have been landed.  Closing bug.
Comment 4 Radar WebKit Bug Importer 2018-08-28 10:04:19 PDT
<rdar://problem/43802050>
Comment 5 Darin Adler 2018-08-28 19:55:42 PDT
Seems unnecessary to use std::optional<String> since WTF::String already has a null value (distinct from the empty string). Typically we can use null string to mean no string, and we don’t have to involve std::optional. Unless we also need to use null string for some other valid value.
Comment 6 Aditya Keerthi 2018-08-28 22:35:35 PDT
(In reply to Darin Adler from comment #5)
> Seems unnecessary to use std::optional<String> since WTF::String already has
> a null value (distinct from the empty string). Typically we can use null
> string to mean no string, and we don’t have to involve std::optional. Unless
> we also need to use null string for some other valid value.

I will address this in a follow-up patch. I can't think of a case where we'd want to use the null string for a valid value.