Preact: Issue with tabIndex on SVG elements

Created on 11 Apr 2018  路  3Comments  路  Source: preactjs/preact


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

What is the current behaviour?
As per React Issue #10987, setting a tabIndex on elements renders as tabIndex instead of tabindex, causing issues.

If the current behaviour is a bug, please provide the steps to reproduce.
<svg tabIndex={0}> renders incorrectly to <svg tabIndex="0">

What is the expected behaviour?
The tabIndex attribute should render as tabindex="0"

discussion enhancement feedback needed wontfix

Most helpful comment

I'm in agreement with @Kanaye here - the correct name is already defined in the SVG spec, we don't need libraries like React or Preact to take liberties renaming things.

Side note: I also think this goes beyond filesize constraints to a more fundamental issue: changing behavior to deviate from an existing specification causes confusion and adds dangerous platform lock-in.
To see how that plays out, look at developer knowledge of onchange vs oninput over the past 5 years - these standardized events with well-defined behaviors are now misunderstood because React decided to create an entirely new semantic for onchange :(

All 3 comments

Because of size constraints, preact doesn't maintain a list of property mappings.
Maybe this could be handled within preact-compat for compatibility reasons.
But imho a developer should just use tabindex if that 's the attribute he wants to set/change.

I'm in agreement with @Kanaye here - the correct name is already defined in the SVG spec, we don't need libraries like React or Preact to take liberties renaming things.

Side note: I also think this goes beyond filesize constraints to a more fundamental issue: changing behavior to deviate from an existing specification causes confusion and adds dangerous platform lock-in.
To see how that plays out, look at developer knowledge of onchange vs oninput over the past 5 years - these standardized events with well-defined behaviors are now misunderstood because React decided to create an entirely new semantic for onchange :(

Was this page helpful?
0 / 5 - 0 ratings