Open fregante opened 1 year ago
FWIW, Chromium's tests for insertText look synchronous: https://chromium.googlesource.com/chromium/blink.git/+/refs/heads/main/LayoutTests/editing/execCommand/insert-text-not-inheriting-block-properties.html
Presumably, an async focus would look something like (not sure what you're want "refocus" handling to be):
async focus(element, {maxWait}) {
if (document.activeElement === element) return;
const deferred = pDefer();
element.addListener("onfocus", () => {
assert document.activeElement === element;
deferred.resolve();
}, {once: true});
element.focus();
return deferred.promise;
}
It's kind of unfortunate because the module now is synchronous, but with that I'd have to make every call async. But it looks about right
See https://github.com/refined-github/refined-github/issues/6348#issuecomment-1522208858
Maybe it's only Chromium. I wonder if reading
field.value
immediately after forces a synchronous update.