<?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>216418</bug_id>
          
          <creation_ts>2020-09-11 13:30:32 -0700</creation_ts>
          <short_desc>visibility: hidden does not remove focus</short_desc>
          <delta_ts>2020-09-25 16:31:30 -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>New Bugs</component>
          <version>Safari Technology Preview</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=29241</see_also>
          <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="Tim Guan-tin Chien [:timdream]">timdream</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>darin</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>timdream</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>wenson_hsieh</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1687802</commentid>
    <comment_count>0</comment_count>
      <attachid>408558</attachid>
    <who name="Tim Guan-tin Chien [:timdream]">timdream</who>
    <bug_when>2020-09-11 13:30:32 -0700</bug_when>
    <thetext>Created attachment 408558
testcase

STR:

See test case, the page will

0. check the current focused element by looking at `document.activeElement`.
1. focus() the element
2. set visibility: hidden on the element
3. wait for 100ms
4. check the current focused element by looking at `document.activeElement` again.

Expected:

On Chrome on step 4, the focused element is the body

Actual:

On Safari and Firefox, the focused element is still the element.

Note:

1. The inconsistency suggests that there may be a spec issue here.
2. On Chrome sometime a micro task is enough for the focus to moved away, some times it is not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1687803</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2020-09-11 13:30:53 -0700</bug_when>
    <thetext>&lt;rdar://problem/68728487&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1687961</commentid>
    <comment_count>2</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-09-12 12:44:38 -0700</bug_when>
    <thetext>Any change here should wait on the resolution of https://github.com/w3c/uievents/issues/236</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1687964</commentid>
    <comment_count>3</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2020-09-12 12:46:01 -0700</bug_when>
    <thetext>Bug 29241 is the same issue, but with &quot;display: none&quot; rather than &quot;visibility: hidden&quot;.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>408558</attachid>
            <date>2020-09-11 13:30:32 -0700</date>
            <delta_ts>2020-09-11 13:30:32 -0700</delta_ts>
            <desc>testcase</desc>
            <filename>focus-visibility.html</filename>
            <type>text/html</type>
            <size>1136</size>
            <attacher name="Tim Guan-tin Chien [:timdream]">timdream</attacher>
            
              <data encoding="base64">PHN0eWxlPgoKI2VsIHsKICAgIGJhY2tncm91bmQ6IHJlYmVjY2FwdXJwbGU7CiAgICBjb2xvcjog
d2hpdGU7Cn0KCgojZWwuaGlkZGVuIHsKICAgIHZpc2liaWxpdHk6IGhpZGRlbjsKfQoKPC9zdHls
ZT4KPHNjcmlwdD4KCndpbmRvdy5vbmxvYWQgPSBhc3luYyAoKSA9PiB7CiAgICBsZXQgZWwgPSBk
b2N1bWVudC5nZXRFbGVtZW50QnlJZCgiZWwiKTsKICAgIGx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