Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG with xlinkHref breaks tab-key focus on Safari 10 #7852

Closed
dotch opened this issue Oct 3, 2016 · 10 comments
Closed

SVG with xlinkHref breaks tab-key focus on Safari 10 #7852

dotch opened this issue Oct 3, 2016 · 10 comments

Comments

@dotch
Copy link

dotch commented Oct 3, 2016

Do you want to request a feature or report a bug?

Bug report

What is the current behavior?

On Safari 10:
Given a document with 2 input fields, separated by an svg that uses a xlinkHref, when focusing the first and pressing the tab key, the focus is not switched to the second input. Instead the address bar or another browser element gets focused.

I am not sure if this is an issue with React or with Safari, but I could not reproduce it on Safari without using React, so I am opening this issue here.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

https://jsfiddle.net/zete1of2/

Try to use the tab key to jump from the first to the second input field.

What is the expected behavior?

Pressing the tab key sets focus on the second input field (works fine on other browsers)

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

Safari Version 10.0 (11602.1.50.0.10)
OSX 10.11.6
React 15.3.2

@aweary
Copy link
Contributor

aweary commented Oct 4, 2016

@dotch thanks for the report! I was able to reproduce this outside of React, so it looks like this is an issue with Safari.

var container = document.getElementById('container');
var root = document.createElement('root');
var input1 = document.createElement('input');
var input2 = document.createElement('input');
var svg = document.createElementNS("http://www.w3.org/2000/svg", 'svg');
var use = document.createElementNS('http://www.w3.org/2000/svg', 'use');

use.setAttributeNS( "http://www.w3.org/1999/xlink", "href", "#Icon" );

svg.appendChild(use)
root.appendChild(input1)
root.appendChild(svg)
root.appendChild(input2)
container.appendChild(root)

You can verify the issue still occurs here: https://jsfiddle.net/ermtc0tq/3/. I've submitted a bug report to Apple 👍

@aweary aweary closed this as completed Oct 4, 2016
@danburzo
Copy link

danburzo commented Oct 5, 2016

Hi @aweary, thanks for investigating! Can you link us to the bug report so we can keep track of it? ✌️

@aweary
Copy link
Contributor

aweary commented Oct 5, 2016

@danburzo I submitted the report through the feedback form which has a bug report category, and they don't let you track the report 😢

I don't personally have a developer account with Apple so I don't have access to https://bugreport.apple.com/, but it might be worth reporting it there too if anyone wants to!

@sarbbottam
Copy link

I have reported the bug 28917455 but I don't think I can share the URL. Please find the screenshot of the report like so:
screen shot 2016-10-24 at 10 09 52 am

@aweary
Copy link
Contributor

aweary commented Oct 24, 2016

Thanks so much @sarbbottam!

@sarbbottam
Copy link

FYI

xlink:href is deprecated and one should use href. However, the issue exist with href too.

I have updated the bug report.

@rikani
Copy link

rikani commented Jan 4, 2017

Focus will work if put any symbol between </use> and </svg>.
Examples:
<svg><use xlink:href="#icon" /><!-- comment --></svg>
<svg><use xlink:href="#icon" /> </svg>
<svg><use xlink:href="#icon" />😊</svg>

@sarbbottam
Copy link

@rikani good to know that. Thanks!

mbektimirov added a commit to FoxComm/the-perfect-gourmet that referenced this issue Jan 20, 2017
@Meroje
Copy link

Meroje commented Feb 18, 2017

It seems to be fixed on safari 10.1, I can't reproduce with @aweary's fiddle

@mmgucci
Copy link

mmgucci commented Feb 22, 2017

The fix suggested by @rikani worked for me. Also note that prepending a symbol before the <use> will also enable navigating backwards using tab
<svg> <use xlink:href="#icon" /> </svg>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants