Skip to content

A platform for community discussion. Free, open, simple.

Revert "UX: Open bulk manage tags replace tag choosers above field on mobile (#39632)" (#39782)

Alan Guo Xiang Tan5a21615e8fb7
diff --git a/app/assets/stylesheets/common/select-kit/select-kit.scss b/app/assets/stylesheets/common/select-kit/select-kit.scss
index 83458eb6a85..7f8de5b7c36 100644
--- a/app/assets/stylesheets/common/select-kit/select-kit.scss
+++ b/app/assets/stylesheets/common/select-kit/select-kit.scss
@@ -31,17 +31,6 @@
pointer-events: none;
}
- &.is-placed-above.is-expanded {
- .select-kit-body {
- flex-direction: column-reverse;
- }
-
- .select-kit-collection {
- display: flex;
- flex-direction: column-reverse;
- }
- }
-
&.is-expanded {
z-index: z("dropdown");
diff --git a/frontend/discourse/app/components/modal/bulk-topic-actions/manage-tags-form.gjs b/frontend/discourse/app/components/modal/bulk-topic-actions/manage-tags-form.gjs
index 8a87c04a700..4ea0784c7fd 100644
--- a/frontend/discourse/app/components/modal/bulk-topic-actions/manage-tags-form.gjs
+++ b/frontend/discourse/app/components/modal/bulk-topic-actions/manage-tags-form.gjs
@@ -4,7 +4,6 @@ import { action } from "@ember/object";
import { trustHTML } from "@ember/template";
import Form from "discourse/components/form";
import icon from "discourse/helpers/d-icon";
-import { bind } from "discourse/lib/decorators";
import { i18n } from "discourse-i18n";
export default class ManageTagsForm extends Component {
@@ -45,15 +44,6 @@ export default class ManageTagsForm extends Component {
return tags?.length ? tags : undefined;
}
- @bind
- mobilePlacementForReplaceRowTagChooser(rows, index) {
- const rowsBelow = rows.length - 1 - index;
- if (rowsBelow < 3) {
- return "top";
- }
- return null;
- }
-
@action
removeReplaceRow(collection, index) {
collection.remove(index);
@@ -238,10 +228,6 @@ export default class ManageTagsForm extends Component {
index
"to"
}}
- @mobilePlacement={{this.mobilePlacementForReplaceRowTagChooser
- transientData.replace_rows
- index
- }}
/>
</collection.Field>
</row.Col>
@@ -271,10 +257,6 @@ export default class ManageTagsForm extends Component {
index
"from"
}}
- @mobilePlacement={{this.mobilePlacementForReplaceRowTagChooser
- transientData.replace_rows
- index
- }}
/>
</collection.Field>
</row.Col>
diff --git a/frontend/discourse/app/form-kit/components/fk/control/tag-chooser.gjs b/frontend/discourse/app/form-kit/components/fk/control/tag-chooser.gjs
index cf174bea97f..a337d9c5f71 100644
--- a/frontend/discourse/app/form-kit/components/fk/control/tag-chooser.gjs
+++ b/frontend/discourse/app/form-kit/components/fk/control/tag-chooser.gjs
@@ -26,7 +26,6 @@ export default class FKControlTagChooser extends FKBaseControl {
filterPlaceholder=@placeholder
maximum=@maximum
- mobilePlacement=@mobilePlacement
}}
class="form-kit__control-tag-chooser"
/>
diff --git a/frontend/discourse/select-kit/components/select-kit.js b/frontend/discourse/select-kit/components/select-kit.js
index e442edad8d2..405c5ecb7bf 100644
--- a/frontend/discourse/select-kit/components/select-kit.js
+++ b/frontend/discourse/select-kit/components/select-kit.js
@@ -127,7 +127,6 @@ function protoProp(prototype, key, descriptor) {
@classNameBindings(
"selectKit.isLoading:is-loading",
"selectKit.isExpanded:is-expanded",
- "selectKit.isPlacedAbove:is-placed-above",
"selectKit.options.disabled:is-disabled",
"selectKit.isHidden:is-hidden",
"selectKit.hasSelection:has-selection"
@@ -162,7 +161,6 @@ function protoProp(prototype, key, descriptor) {
autofocus: false,
placementStrategy: null,
mobilePlacementStrategy: null,
- mobilePlacement: null,
desktopPlacementStrategy: null,
hiddenValues: null,
disabled: false,
@@ -216,7 +214,6 @@ export default class SelectKit extends Component {
isLoading: false,
isHidden: false,
isExpanded: false,
- isPlacedAbove: false,
isFilterExpanded: false,
enterDisabled: false,
hasSelection: false,
@@ -962,7 +959,6 @@ export default class SelectKit extends Component {
this.selectKit.setProperties({
isExpanded: false,
- isPlacedAbove: false,
filter: null,
});
}
@@ -976,12 +972,16 @@ export default class SelectKit extends Component {
this.clearErrors();
this.selectKit.onOpen(event);
- this.cleanupFloatingUi?.();
- this.cleanupFloatingUi = autoUpdate(
- this.getHeader(),
- this._bodyElement(),
- () => this.updateFloatingUiPosition()
- );
+ if (this.site.desktopView) {
+ this.cleanupFloatingUi?.();
+ this.cleanupFloatingUi = autoUpdate(
+ this.getHeader(),
+ this._bodyElement(),
+ () => this.updateFloatingUiPosition()
+ );
+ } else {
+ this.updateFloatingUiPosition();
+ }
this.selectKit.setProperties({
isExpanded: true,
@@ -1094,11 +1094,11 @@ export default class SelectKit extends Component {
hide(),
];
- return computePosition(referenceElement, floatingElement, {
- placement: this._computePlacement(),
+ computePosition(referenceElement, floatingElement, {
+ placement: this.selectKit.options.placement,
strategy,
middleware,
- }).then(({ x, y, placement, middlewareData }) => {
+ }).then(({ x, y, middlewareData }) => {
const style = {
width,
minWidth,
@@ -1117,7 +1117,6 @@ export default class SelectKit extends Component {
}
}
- this.selectKit.set("isPlacedAbove", placement.startsWith("top"));
Object.assign(floatingElement.style, style);
});
}
@@ -1213,14 +1212,6 @@ export default class SelectKit extends Component {
return placementStrategy;
}
- _computePlacement() {
- if (this.site.mobileView && this.selectKit.options.mobilePlacement) {
- return this.selectKit.options.mobilePlacement;
- }
-
- return this.selectKit.options.placement;
- }
-
_deprecated(text) {
deprecated(text, {
since: "v2.4.0",
diff --git a/frontend/discourse/tests/integration/components/select-kit/single-select-test.gjs b/frontend/discourse/tests/integration/components/select-kit/single-select-test.gjs
index e719f372183..03db5283f88 100644
--- a/frontend/discourse/tests/integration/components/select-kit/single-select-test.gjs
+++ b/frontend/discourse/tests/integration/components/select-kit/single-select-test.gjs
@@ -2,7 +2,6 @@ import { hash } from "@ember/helper";
import { find, render, tab } from "@ember/test-helpers";
import { module, test } from "qunit";
import DButton from "discourse/components/d-button";
-import { forceMobile } from "discourse/lib/mobile";
import SingleSelect from "discourse/select-kit/components/single-select";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import selectKit from "discourse/tests/helpers/select-kit-helper";
@@ -507,30 +506,6 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
assert.true(header.bottom > body.top, "correctly offsets the body");
});
- test("options.mobilePlacement", async function (assert) {
- forceMobile();
- setDefaultState(this);
-
- await render(
- <template>
- <div style="position: fixed; top: 50%; left: 0; right: 0;">
- <SingleSelect
- @value={{this.value}}
- @content={{this.content}}
- @options={{hash mobilePlacement="top"}}
- />
- </div>
- </template>
- );
- await this.subject.expand();
-
- const header = find(".select-kit-header").getBoundingClientRect();
- const body = find(".select-kit-body").getBoundingClientRect();
-
- assert.true(body.bottom < header.top, "body opens above the header");
- assert.dom(".select-kit").hasClass("is-placed-above");
- });
-
test("options.expandedOnInsert", async function (assert) {
setDefaultState(this);
await render(