Skip to content

Bug: Support the new <geolocation> element #35571

@jhuleatt

Description

@jhuleatt

I tried using the new <geolocation> element in Chrome, but React didn't recognize the props.

This element is only available in Chrome so far, and only in Chrome 144+. Not sure what the policy is for adding new elements to React, but thought I'd log this.

React version: 19.2.3

Steps To Reproduce

  1. Use Chrome 144 or higher
  2. Try to view a React component with the <geolocation> html element, like this:
function Location() {
  const handleLocation = (e) => {
    console.log(e);
  };

  return (
    <geolocation
      onLocation={handleLocation}
      autoLocate={false}
      accuracyMode="precise"
    ></geolocation>
  );
}

Link to code example:

https://stackblitz.com/edit/react-geolocation-repro?file=src%2FApp.jsx

The current behavior

The component renders, but with console errors:

Unknown event handler property `onLocation`. It will be ignored.
React does not recognize the `autoLocate` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `autolocate` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
React does not recognize the `accuracyMode` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `accuracymode` instead. If you accidentally passed it from a parent component, remove it from the DOM element.

The expected behavior

React recognizes the props for <geolocation/> as documented in https://developer.chrome.com/blog/geolocation-html-element#implementation

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions