# Editor focus handling in 2.1.53+

**URL:** <https://forums.ankiweb.net/t/editor-focus-handling-in-2-1-53/20983>\
**Category:** Beta Testing\
**Created:** [June 24, 2022, 6:39am UTC](https://forums.ankiweb.net/t/editor-focus-handling-in-2-1-53/20983 "2022-06-24T06:39:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![prollo](https://avatars.discourse-cdn.com/v4/letter/p/a5b964/32.png) [@prollo](https://forums.ankiweb.net/u/prollo)\
**Post date:** [June 24, 2022, 6:39am UTC](https://forums.ankiweb.net/t/editor-focus-handling-in-2-1-53/20983/1 "2022-06-24T06:39:52Z")

</div>

Hi,  
a user of an add-on just reported an issue in 2.1.53 to me, and I just tested and can confirm it.  
The add-on in case inserts additional UI elements in the Add window. Some of the add-on’s functionality depends on being able to select text in that inserted UI.

However, 2.1.53 seems to not allow to select anything outside the fields text boxes. As soon as I focus one of the fields, I cannot select anything outside anymore (I can actually perform the select operation, i.e. dragging over some text, but on mouse release, nothing happens).  
I’m having a hard time understanding the new editor field components, maybe someone could point me into the direction of what changes in 2.1.53 caused this change in behaviour? I can confirm it was still working in 2.1.52.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/4/40886eb0b0e221f9dd794f2363011e4091f1f658.png)

Add-on in case, e.g. you cannot select text in the PDF anymore in 2.1.53.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [June 24, 2022, 7:48am UTC](https://forums.ankiweb.net/t/editor-focus-handling-in-2-1-53/20983/2 "2022-06-24T07:48:35Z")

</div>

Can you bisect the changes to figure out which commit broke your use case?

---

<div class="post-metadata">

**Author:** ![hengiesel](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/hengiesel/32/920_2.png) [@hengiesel](https://forums.ankiweb.net/u/hengiesel)\
**Post date:** [June 24, 2022, 9:08am UTC](https://forums.ankiweb.net/t/editor-focus-handling-in-2-1-53/20983/3 "2022-06-24T09:08:43Z")

</div>

My guess would be [#1861](https://github.com/ankitects/anki/pull/1861)

---

<div class="post-metadata">

**Author:** ![prollo](https://avatars.discourse-cdn.com/v4/letter/p/a5b964/32.png) [@prollo](https://forums.ankiweb.net/u/prollo)\
**Post date:** [June 24, 2022, 12:23pm UTC](https://forums.ankiweb.net/t/editor-focus-handling-in-2-1-53/20983/4 "2022-06-24T12:23:13Z")

</div>

That seems definitely like it.  
Is that intended behaviour as it is working right now? As far as I understand it, on the blur event, the component checks which element was clicked(?), and if it is another input, it receives focus, otherwise, the element focuses itself again?

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [June 28, 2022, 11:28am UTC](https://forums.ankiweb.net/t/editor-focus-handling-in-2-1-53/20983/5 "2022-06-28T11:28:14Z")

</div>

Have you been able to find a workaround @prollo? If this is something that can’t be fixed without changes to Anki, maybe we could look into a flag the add-on can set to disable this functionality or similar.

---

<div class="post-metadata">

**Author:** ![prollo](https://avatars.discourse-cdn.com/v4/letter/p/a5b964/32.png) [@prollo](https://forums.ankiweb.net/u/prollo)\
**Post date:** [June 28, 2022, 12:56pm UTC](https://forums.ankiweb.net/t/editor-focus-handling-in-2-1-53/20983/6 "2022-06-28T12:56:54Z")

</div>

A friendly person on Github found a workaround:

```auto
let siacView = document.getElementById('siac-right-side');

siacView.addEventListener('mousedown', function() {
    // one solution would be to have a hidden field for this sole purpose
    let someNonAnkiField = document.getElementById('siac-pdf-page-inp');
    someNonAnkiField.focus();
    someNonAnkiField.blur();
}, false);

```

It works, but feels kinda hack-ish.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [July 1, 2022, 12:29am UTC](https://forums.ankiweb.net/t/editor-focus-handling-in-2-1-53/20983/7 "2022-07-01T00:29:34Z")

</div>

@hengiesel is there some easy change we could make to improve the situation, or do we need to start recommending this approach going forward?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [May 1, 2023, 2:54am UTC](https://forums.ankiweb.net/t/editor-focus-handling-in-2-1-53/20983/8 "2023-05-01T02:54:37Z")

</div>

Closed on May 1, 2023, 2:54am UTC


