FIX: Correct select-kit positioning strategy in modals (#23096)

The new modal API removed the `#discourse-modal` id from the wrapper element, which meant that select-kit couldn't properly detect when it was inside a modal. This commit updates the detection to use `.fixed-modal` which will match both legacy and modern modals.
This commit is contained in:
David Taylor 2023-08-15 10:50:41 +01:00 committed by GitHub
parent 957bff4f5d
commit e722a14700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -860,7 +860,7 @@ export default Component.extend(
this.clearErrors();
const inModal = this.element.closest("#discourse-modal");
const inModal = this.element.closest(".fixed-modal");
if (inModal && this.site.mobileView) {
const modalBody = inModal.querySelector(".modal-body");
modalBody.style = "";
@ -884,7 +884,7 @@ export default Component.extend(
this.selectKit.onOpen(event);
if (!this.popper) {
const inModal = this.element.closest("#discourse-modal .modal-body");
const inModal = this.element.closest(".fixed-modal .modal-body");
const anchor = document.querySelector(
`#${this.selectKit.uniqueID}-header`
);
@ -948,7 +948,7 @@ export default Component.extend(
fn: ({ state }) => {
if (inModal) {
const innerModal = document.querySelector(
"#discourse-modal div.modal-inner-container"
".fixed-modal div.modal-inner-container"
);
if (innerModal) {