mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user