FIX: Fix select kit size (#10094)

This commit is contained in:
Bianca Nenciu 2020-06-22 16:48:00 +03:00 committed by GitHub
parent 8cc8e80d7a
commit aff9bfd5bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -800,15 +800,19 @@ export default Component.extend(
name: "applySmallScreenMaxWidth",
enabled: window.innerWidth <= 450,
phase: "beforeWrite",
fn({ state }) {
fn: ({ state }) => {
if (inModal) {
const innerModal = document.querySelector(
"#discourse-modal div.modal-inner-container"
);
if (innerModal) {
state.styles.popper.width = `${innerModal.clientWidth -
20}px`;
if (this.multiSelect) {
state.styles.popper.width = `${this.element.offsetWidth}px`;
} else {
state.styles.popper.width = `${innerModal.clientWidth -
20}px`;
}
}
} else {
state.styles.popper.width = `${window.innerWidth - 20}px`;