Skip to content

Selectize throws error in Firefox if in an iframe with display:none #520

@wch

Description

@wch

When selectize is used in an iframe with display:none, it throws an error. It's due to this long-standing bug in Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=548397

The JS console says:

TypeError: window.getComputedStyle(...) is null selectize.min.js:2

The error is due to this line:
https://github.com/brianreavis/selectize.js/blob/6a071a2809802176ebc01703b98109784ec5b931/src/selectize.js#L7

In particular:

window.getComputedStyle(input, null).getPropertyValue('direction')

In the hidden iframe situation, window.getComputedStyle(input, null) returns null, but another function call is chained after it.

We've encountered this error on a different project, and our workaround is here:
rstudio/shiny#550

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions