<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>141758</bug_id>
          
          <creation_ts>2015-02-18 09:21:35 -0800</creation_ts>
          <short_desc>Finding an option in a select element shouldn&apos;t be reset when the user types a space</short_desc>
          <delta_ts>2023-06-16 09:48:02 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Forms</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>OS X 10.10</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Adele Peterson">adele</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>adele</cc>
    
    <cc>ahmad.saleem792</cc>
    
    <cc>akeerthi</cc>
    
    <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>hyatt</cc>
    
    <cc>jonlee</cc>
    
    <cc>kandalkar.abhijeet58</cc>
    
    <cc>rniwa</cc>
    
    <cc>spam-webkit</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1070125</commentid>
    <comment_count>0</comment_count>
      <attachid>246820</attachid>
    <who name="Adele Peterson">adele</who>
    <bug_when>2015-02-18 09:21:35 -0800</bug_when>
    <thetext>Created attachment 246820
Test case

Finding an option in a select element shouldn&apos;t be reset when the user types a space.

Steps to reproduce:
1) Load the attached test case
2) Hit tab twice to focus the select element
3) Type &quot;United S&quot;

When you hit the space, the search string is reset, and when you next type &quot;S&quot;, &quot;Spain&quot; is selected.  I expect &quot;United States&quot; to be selected.

Firefox behaves correctly, Chrome matches our behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1070128</commentid>
    <comment_count>1</comment_count>
    <who name="Adele Peterson">adele</who>
    <bug_when>2015-02-18 09:33:12 -0800</bug_when>
    <thetext>rdar://problem/19875341</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1071125</commentid>
    <comment_count>2</comment_count>
    <who name="Adele Peterson">adele</who>
    <bug_when>2015-02-22 21:12:09 -0800</bug_when>
    <thetext>WebKit considers the event to be handled once the popup opens.  I played around with trying to call typeAheadFind before opening the menu, but that doesn&apos;t really help.  The searching WebKit does in the select element before the menu opens is separate from any searching that happens after the menu is open (which I think is handled by AppKit).  So even if WebKit&apos;s search string includes the space, it doesn&apos;t help because the AppKit menu doesn&apos;t know anything about the characters that were typed before the menu was opened.  So I think the challenge here is to find a way to pass this info along.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1082201</commentid>
    <comment_count>3</comment_count>
    <who name="Abhijeet Kandalkar">kandalkar.abhijeet58</who>
    <bug_when>2015-04-02 03:03:59 -0700</bug_when>
    <thetext>Related chromium issue :
https://code.google.com/p/chromium/issues/detail?id=473050</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1899310</commentid>
    <comment_count>4</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-09-18 03:27:53 -0700</bug_when>
    <thetext>I think this is added already here:

https://github.com/WebKit/WebKit/blob/5a8883c75f0a425515a601a4eb8de66e88ada97d/Source/WebCore/html/HTMLSelectElement.cpp#L1213

rniwa@webkit.org - Can you confirm? Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1899407</commentid>
    <comment_count>5</comment_count>
    <who name="Ryosuke Niwa">rniwa</who>
    <bug_when>2022-09-18 18:47:52 -0700</bug_when>
    <thetext>The issue still reproduces in Safari whereas Chrome &amp; Firefox will select &quot;United States&quot; upon typing &quot;united s&quot;. The space after &quot;united&quot; is opening the popup instead of changing the selection to &quot;united states&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1962131</commentid>
    <comment_count>6</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-06-16 09:48:02 -0700</bug_when>
    <thetext>Potential merge - https://src.chromium.org/viewvc/blink?view=revision&amp;revision=193280

^ I merged locally with following changes:

&lt; In HTMLSelectElement.cpp &gt;

Line 1245:

if ((keyCode == &apos; &apos; &amp;&amp; !m_typeAhead.hasActiveSession(&amp;keyboardEvent)) || keyCode == &apos;\r&apos;) {

in HTMLSelectElement::menuListDefaultEventHandler.

_______

&lt; In TypeAhead.h &gt;

    bool hasActiveSession(KeyboardEvent*);

_____

&lt; In TypeAhead.cpp &gt;


bool TypeAhead::hasActiveSession(KeyboardEvent* event)
{
    Seconds delta = event-&gt;timeStamp() - m_lastTypeTime;
    return delta &lt;= typeAheadTimeout;
}

______


This compiles but it does not fixed attached testcase. :-(</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>246820</attachid>
            <date>2015-02-18 09:21:35 -0800</date>
            <delta_ts>2015-02-18 09:21:35 -0800</delta_ts>
            <desc>Test case</desc>
            <filename>test.html</filename>
            <type>text/html</type>
            <size>159</size>
            <attacher name="Adele Peterson">adele</attacher>
            
              <data encoding="base64">PGlucHV0Pgo8c2VsZWN0PgogICAgPG9wdGlvbj5DYW5hZGE8L29wdGlvbj4KICAgIDxvcHRpb24+
U3BhaW48L29wdGlvbj4KICAgIDxvcHRpb24+VW5pdGVkIEFyYWIgRW1lcml0ZXM8L29wdGlvbj4K
ICAgIDxvcHRpb24+VW5pdGVkIFN0YXRlczwvb3B0aW9uPgo8L3NlbGVjdD4K
</data>

          </attachment>
      

    </bug>

</bugzilla>