FIX: improves positioning of sk in mobile when inside a modal (#9657)
This commit is contained in:
parent
136a545653
commit
87b1d435d2
|
@ -782,17 +782,30 @@ export default Component.extend(
|
|||
enabled: window.innerWidth <= 450,
|
||||
phase: "main",
|
||||
fn({ state }) {
|
||||
if (!inModal) {
|
||||
let { x } = state.elements.reference.getBoundingClientRect();
|
||||
state.modifiersData.popperOffsets.x = -x + 10;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "applySmallScreenMaxWidth",
|
||||
enabled: window.innerWidth <= 450,
|
||||
phase: "beforeWrite",
|
||||
fn({ state }) {
|
||||
if (inModal) {
|
||||
const innerModal = document.querySelector(
|
||||
"#discourse-modal div.modal-inner-container"
|
||||
);
|
||||
|
||||
if (innerModal) {
|
||||
state.styles.popper.width = `${innerModal.clientWidth -
|
||||
20}px`;
|
||||
}
|
||||
} else {
|
||||
state.styles.popper.width = `${window.innerWidth - 20}px`;
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: "sameWidth",
|
||||
|
|
Loading…
Reference in New Issue