mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 19:53:53 -06:00
FIX: Skip composer blur event when switching apps in iOS
This commit is contained in:
parent
b6d140e4bd
commit
4b43816bb6
@ -112,9 +112,15 @@ function positioningWorkaround($fixedElement) {
|
||||
// document.activeElement is also unreliable (iOS does not mark buttons as focused)
|
||||
// so instead, we store the last touched element and check against it
|
||||
|
||||
// cancel blur event if user is:
|
||||
// - switching to another iOS app
|
||||
// - invoking a select-kit dropdown
|
||||
// - invoking mentions
|
||||
// - invoking a toolbar button
|
||||
if (
|
||||
lastTouchedElement &&
|
||||
($(lastTouchedElement).hasClass("select-kit-header") ||
|
||||
(document.visibilityState === "hidden" ||
|
||||
$(lastTouchedElement).hasClass("select-kit-header") ||
|
||||
$(lastTouchedElement).closest(".autocomplete").length ||
|
||||
["span", "svg", "button"].includes(
|
||||
lastTouchedElement.nodeName.toLowerCase()
|
||||
@ -227,6 +233,11 @@ function positioningWorkaround($fixedElement) {
|
||||
};
|
||||
const observer = new MutationObserver(checkForInputs);
|
||||
observer.observe(fixedElement, config);
|
||||
|
||||
// document.addEventListener("visibilitychange", () => {
|
||||
// console.log(document.visibilityState);
|
||||
// console.log(lastTouchedElement);
|
||||
// });
|
||||
}
|
||||
|
||||
export default positioningWorkaround;
|
||||
|
Loading…
Reference in New Issue
Block a user