Escape keydown gets TypeError on Dropdown elements
Created by: gianlucagiacometti
Prerequisites
-
I have searched for duplicate or closed issues -
I have validated any HTML to avoid common problems -
I have read the contributing guidelines
Describe the issue
Go to the official Bootstrap 5.2 Docs Select "Dropdowns" form the list on the left Go down to "Disabled" Click on "Regular link" or "Another link" Type "ESC" key
You got
Uncaught TypeError: Cannot read properties of undefined (reading 'parentNode')
at new hi (dropdown.js:97:34)
at hi.getOrCreateInstance (base-component.js:65:41)
at HTMLUListElement.dataApiKeydownHandler (dropdown.js:418:31)
at HTMLDocument.n (event-handler.js:118:19)
I am developing a class to improve the select component, and I want my dropdown to hide manually with the Esc key. I got this issue. To check if it was just my mistake I checked on Bootstrap Docs for a similar behaviour, which happens exactly in the same way.
Reduced test cases
I tried to intercept the keydown in the html element but it did not work
What operating system(s) are you seeing the problem on?
Windows
What browser(s) are you seeing the problem on?
Chrome, Firefox, Microsoft Edge
What version of Bootstrap are you using?
5.2.2