debugger icon indicating copy to clipboard operation
debugger copied to clipboard

[Editor] Context menu `Add conditional breakpoints` should focus condition input

Open digitarald opened this issue 9 years ago • 10 comments

STR:

  • Open https://mozilladevelopers.github.io/sample-todo/03-conditional-breakpoints/
  • Right click on a line number in Debugger and click Add conditional breakpoints

AR:

  • Input isn't focused

ER:

  • Focus input field to start typing condition

This works as expected when the breakpoint is created normally and then made conditional by right clicking Add condition in the Breakpoints section.

digitarald avatar Nov 29 '17 07:11 digitarald

/claim

zaggy avatar Nov 29 '17 11:11 zaggy

Thanks for claiming the issue! :wave:

Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.

:fox_face: Debugger team!

claim avatar Nov 29 '17 11:11 claim

I wasn't able to reproduce the issue. Possible to send a gif of the AR @digitarald?

field-focus

GarethSharpe avatar Jan 01 '18 20:01 GarethSharpe

Not working for me in Nightly/OSX using the STR.

digitarald avatar Jan 03 '18 01:01 digitarald

I was not able to reproduce on Nightly and Chrome on Windows 10. Could this be specific to OSX?

AlexisDeschamps avatar Jan 30 '18 22:01 AlexisDeschamps

@AlexisDeschamps yeah - it could be...

jasonLaster avatar Jan 30 '18 22:01 jasonLaster

It seems that the problem arises when the Debugger is used within a panel instead of just the launchpad.

AlexisDeschamps avatar Feb 02 '18 22:02 AlexisDeschamps

Doing this simple check:

const activeElementIsFocused = document.activeElement == this.input && document.hasFocus(); console.log("Input is focused:", activeElementIsFocused);

Right after the this.input.focus() in the renderToWidget it will always return true whether the conditional panel input is focused or not. Whereas, if you add in a componentDidUpdate section and check under that lifecycle event this will accurately return true when the input box shows focused and false when the input box is not focused.

This tells me that somewhere in between renderToWidget and componentDidUpdate the input loses focus.. sometimes.

Originally I fixed the issue with a setTimeout in the renderToWidget, thereafter I changed the fix to just put the this.input.focus() into the componentDidUpdate.

Currently, I am writing a mochi test for the issue.

mmcote avatar Feb 13 '18 15:02 mmcote

@digitarald is it fixed for you now?

lukaszsobek avatar Feb 24 '18 17:02 lukaszsobek

@lukaszsobek not yet. We're still working on landing a patch that passes mochitests

jasonLaster avatar Feb 25 '18 00:02 jasonLaster