microsoft / tabster

Web Application Keyboard Navigation Tools
https://tabster.io
MIT License
116 stars 34 forks source link

Tabster crashes in Firefox #381

Open petewu100 opened 4 months ago

petewu100 commented 4 months ago

When pressing Tab in a web app that uses Tabster in Firefox, I hit a crash in the following code in Focusable.ts:

private _isHidden(el: HTMLElement): boolean {
    const attrVal = el.getAttribute("aria-hidden");

    if (attrVal && attrVal.toLowerCase() === "true") {
        if (!this._tabster.modalizer?.isAugmented(el)) {
            return true;
        }
    }

    return false;
}

The loop in isAccessible proceeds all the up the DOM to the HTMLDocument element and el.getAttribute is not defined for the HTMLDocument element so it crashes on the first line of _isHidden. Seems like the code should check if el.getAttribute is defined before trying to call it.

ling1726 commented 3 months ago

@petewu100 can you provide a repro for this? Trying to call getAttribute on Firefox I can't see that getAttribute is undefined

image