Will form event's `nativeEvent.submitter.name` work consistently across all browsers?

Viewed 524

I'm building very simple forms with multiple submit buttons in React.

function SomeForm() {
 const onSubmit = (e: FormEvent) => {
  e.preventDefault();
  console.log("submitted form button name is", e.nativeEvent?.submitter.name);
 }
 return (
 <form onSubmit={onSubmit}>
  <input type="text" name="someInput" />
  <button type="submit" name="btn1">Btn1</button>
  <button type="submit" name="btn2">Btn2</button>
 </form>
 );
}

Will form event's nativeEvent.submitter.name work consistently across all browsers?

1 Answers

In the case of Safari caniuse.com reports that there is a bug with buttons, otherwise it seems to work. But if you look at the the bug report Bug 229660 you can see that it has been fixed.

Related