SitePen / dgrid

A lightweight, mobile-ready, data-driven, modular grid widget designed for use with dstore
http://dgrid.io/
Other
628 stars 298 forks source link

Fix checkbox/radio shared editor on Mac #1459

Closed msssk closed 4 years ago

msssk commented 4 years ago

Editor: wrap checkbox and radio button shared editors on Mac

In OS X form controls are not considered focusable elements. Some browsers (Safari, Firefox) adopt this decision: whatwg/html/issues/4356 https://bugzilla.mozilla.org/show_bug.cgi?id=1524863 https://bugs.webkit.org/show_bug.cgi?id=22261 The resulting implementation is broken - you can call focus() on a checkbox and it will be focused, but clicking on a checkbox does not focus it. Further, clicking on a focused checkbox blurs it. To overcome these challenges checkboxes and radios are wrapped in a div that can receive focus (and blur) in a consistent manner. Without the wrapper a valid blur is indistinguishable from an invalid blur. With the wrapper the blur event's target and relatedTarget enable reliably identifying invalid blurs and ignoring them.

Notes

Fixes #1458