FIX: relies on native focus behavior in chat emoji picker (#21092)
This codepath was responsible to scroll to the first emoji of a section, however `scrollIntoView` was not super reliable and was also causing the whole page to scroll with drawer. This is also simply not necessary code as native focus behavior will scroll to the element.
This commit is contained in:
parent
bd5c5c4b5f
commit
9b3408223b
|
@ -197,7 +197,6 @@
|
|||
this.chatEmojiReactionStore.diversity
|
||||
}}
|
||||
loading="lazy"
|
||||
{{on "focus" this.didFocusFirstEmoji}}
|
||||
/>
|
||||
{{/let}}
|
||||
|
||||
|
|
|
@ -357,14 +357,6 @@ export default class ChatEmojiPicker extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
@action
|
||||
didFocusFirstEmoji(event) {
|
||||
event.preventDefault();
|
||||
const section = event.target.closest(".chat-emoji-picker__section").dataset
|
||||
.section;
|
||||
this.didRequestSection(section);
|
||||
}
|
||||
|
||||
@action
|
||||
didRequestSection(section) {
|
||||
const scrollableContent = document.querySelector(
|
||||
|
@ -388,12 +380,10 @@ export default class ChatEmojiPicker extends Component {
|
|||
|
||||
schedule("afterRender", () => {
|
||||
document
|
||||
.querySelector(`.chat-emoji-picker__section[data-section="${section}"]`)
|
||||
.scrollIntoView({
|
||||
behavior: "auto",
|
||||
block: "start",
|
||||
inline: "start",
|
||||
});
|
||||
.querySelector(
|
||||
`.chat-emoji-picker__section[data-section="${section}"] .emoji:nth-child(1)`
|
||||
)
|
||||
.focus();
|
||||
|
||||
later(() => {
|
||||
// iOS hack to avoid blank div when requesting section during momentum
|
||||
|
|
|
@ -128,7 +128,8 @@ module("Discourse Chat | Component | chat-emoji-picker", function (hooks) {
|
|||
await click(`.chat-emoji-picker__section-btn[data-section="objects"]`);
|
||||
|
||||
assert.true(
|
||||
document.querySelector("#ember-testing-container").scrollTop > 0,
|
||||
document.querySelector(".chat-emoji-picker__scrollable-content")
|
||||
.scrollTop > 0,
|
||||
"it scrolls to the section"
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue