keymanapp / keyman

Keyman cross platform input methods system running on Android, iOS, Linux, macOS, Windows and mobile and desktop web
https://keyman.com/
Other
372 stars 102 forks source link

fix(web): support SVG elements when checking className #11365

Closed mcdurdin closed 1 week ago

mcdurdin commented 1 week ago

Fixes #11364.

Instead of using className which may be of type SVGAnimatedString if the element is an SVG element, use getAttribute('class'). As that function can return null if the class attribute is not defined, use optional chaining to avoid a new error...

Uses the same pattern in hardwareEventKeyboard.ts, although I suspect the problem may never arise there.

I audited the uses of className in our KeymanWeb source and found only these three instances which may be problematic. I have not searched elsewhere.

@keymanapp-test-bot skip

keymanapp-test-bot[bot] commented 1 week ago

User Test Results

Test specification and instructions

User tests are not required

Test Artifacts

keyman-server commented 1 week ago

Changes in this pull request will be available for download in Keyman version 17.0.320-beta