question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TextField looses focus in Notebook view

See original GitHub issue

Describe the bug

The TextField looses focus in Notebook view (tested with react).

To reproduce

Render a text field and also a dropdown in a notebook renderer. While mouse down, the text field receives the focus. However on mouse up the text field looses the focus. Therefore the user is unable to enter anything into the text field. Once the dropdown field is removed from the code base, this only happens once after opening a notebook view. So it seems that adding the DropDown leads to the text field constantly loosing focus. Whereas it happens only once if it used without the dropdown.

export const activate: ActivationFunction = context => {
  return {
    renderOutputItem(outputItem, element) {
      const root = createRoot(element);
      root.render(
        <>
          <VSCodeTextField />
          <VSCodeDropdown>
            <VSCodeOption>a</VSCodeOption>
            <VSCodeOption>b</VSCodeOption>
          </VSCodeDropdown>
        </>,
      );
    },
    disposeOutputItem(outputId) {
      // Do any teardown here. outputId is the cell output being deleted, or
      // undefined if we're clearing all outputs.
    }
  };
};

Expected behavior

The text field does not loose focus. Even on the first click/focus.

Current behavior

The text field looses the focus.

Screenshots

Screenshot 2022-06-18 at 18 08 32

Desktop (please complete the following information):

  • OS Version: macOS 12.3.1
  • VSCode: 1.68.1
  • Toolkit Version: v1.0.0

Additional context

The issue could not be reproduced with VSCode 1.67 and before. So the problem seems to have been introduced with VSC 1.68.

Sample Code: Archive.zip

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
bigbugcommented, Jun 21, 2022

@hawkticehurst : I can confirm the bug also occurs with

root.render(
        <>
          <VSCodeDropdown>
            <VSCodeOption>a</VSCodeOption>
            <VSCodeOption>b</VSCodeOption>
          </VSCodeDropdown>
          <VSCodeTextField></VSCodeTextField>
        </>,
      );
1reaction
bigbugcommented, Jul 21, 2022

@hawkticehurst I can confirm that it works again. Thanks for your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does TextField lose focus when views are added around it?
The problem is that when the info texts either appear or disappear, the TextField loses focus! If I use just one text (either...
Read more >
Notebook loses keyboard focus after switching tabs #5789
After switching from a Jupyter notebook to a different tab in VS Code and then back, all keyboard input to the Jupyter notebook...
Read more >
Quickset causes applications to lose focus - Dell Community
In the text box in the Run window, type regedit and click OK. This will open the Registry Editor program. Locate the HKEY_CURRENT_USER...
Read more >
[TextField] loses focus on rerender. Потеря ... - YouTube
[ TextField ] loses focus on rerender. Потеря фокуса TextField material ui. 229 views 1 year ago. Slavik Ogorodnyk. Slavik Ogorodnyk.
Read more >
Windows 10 : Stop any application from stealing focus ever. Is ...
Is there any way to stop applications from stealing focus? Scenario 1: I start typing a password into RDC to remote into a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found