Skip to content

checkClose fails when clicking on SVG element #660

@revgum

Description

@revgum

Clicking outside of the keyboard, on an SVG image (for example) fails with Uncaught TypeError: $target[0].className.indexOf is not a function.

At

if ($target.length && $target[0].className.indexOf(kbcss.keyboard) > -1) {
a simple fix could be either:

if($target.length && $target.hasClass(kbcss.keyboard))

OR

var hasClassName = typeof($target[0].className) === "string" ? $target[0].className.indexOf(kbcss.keyboard) > -1 : false;
// needed for IE to allow switching between keyboards smoothly
if ($target.length && hasClassName) {

For context, $target[0].className is: SVGAnimatedString {baseVal: "map_image", animVal: "map_image"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions