FIX: sk3 wizard regressions (#14120)

This commit is contained in:
Joffrey JAFFEUX
2021-08-23 19:57:42 +02:00
committed by GitHub
parent 3d6cbb5ab3
commit a230362f65
3 changed files with 16 additions and 10 deletions

View File

@@ -77,7 +77,7 @@ export default Component.extend(
this.set(
"selectKit",
EmberObject.create({
uniqueID: this.attrs?.id || guidFor(this),
uniqueID: this.attrs?.id?.value || this.attrs?.id || guidFor(this),
valueProperty: this.valueProperty,
nameProperty: this.nameProperty,
labelProperty: this.labelProperty,
@@ -838,7 +838,7 @@ export default Component.extend(
this.clearErrors();
const inModal = this.element.closest("#discourse-modal");
if (inModal && this.site.mobileView) {
if (inModal && this?.site?.mobileView) {
const modalBody = inModal.querySelector(".modal-body");
modalBody.style = "";
}
@@ -870,7 +870,7 @@ export default Component.extend(
`#${this.selectKit.uniqueID}-body`
);
const placementStrategy = this.site.mobileView ? "absolute" : "fixed";
const placementStrategy = this?.site?.mobileView ? "absolute" : "fixed";
const verticalOffset = 3;
this.popper = createPopper(anchor, popper, {

View File

@@ -1,4 +1,3 @@
import { propertyEqual } from "discourse/lib/computed";
import { action, computed } from "@ember/object";
import Component from "@ember/component";
import I18n from "I18n";
@@ -36,7 +35,7 @@ export default Component.extend(UtilsMixin, {
didInsertElement() {
this._super(...arguments);
if (!this.site.mobileView) {
if (!this?.site?.mobileView) {
this.element.addEventListener("mouseenter", this.handleMouseEnter);
this.element.addEventListener("focus", this.handleMouseEnter);
this.element.addEventListener("blur", this.handleBlur);
@@ -45,7 +44,7 @@ export default Component.extend(UtilsMixin, {
willDestroyElement() {
this._super(...arguments);
if (!this.site.mobileView && this.element) {
if (!this?.site?.mobileView && this.element) {
this.element.removeEventListener("mouseenter", this.handleBlur);
this.element.removeEventListener("focus", this.handleMouseEnter);
this.element.removeEventListener("blur", this.handleMouseEnter);
@@ -115,9 +114,13 @@ export default Component.extend(UtilsMixin, {
return this.getValue(this.selectKit.highlighted);
}),
isHighlighted: propertyEqual("rowValue", "highlightedValue"),
isHighlighted: computed("rowValue", "highlightedValue", function () {
return this.rowValue === this.highlightedValue;
}),
isSelected: propertyEqual("rowValue", "value"),
isSelected: computed("rowValue", "value", function () {
return this.rowValue === this.value;
}),
@action
handleMouseEnter() {