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.

Search input closes immediately after focus

See original GitHub issue

After upgrading to version version 3.0.4, I noticed a behaviour change in the application that I cant immediately figure out.

I have a component like this:

<PowerSelect 
  @class="search-input" 
  @searchMessage="Search"  
  @searchMessageComponent={{component "recently-viewed" recordSelected=(action "recentlyViewedRecordSelected")}}
  @placeholder={{@placeholder}} 
  @search={{perform this.searchTask}} 
  @searchEnabled={{true}}
  @onChange={{action "valueChanged"}} 
  @onFocus={{action "handleFocus"}} 
  @renderInPlace={{true}} as |model|>
  <div class="search-result">
    <div class="name">
      {{model.name}}
    </div>
    <div class="type">
      {{model.constructor.modelName}}
    </div>
  </div>
</PowerSelect>

On focus of the Component, I want to display a list of recently viewed records, which I could accomplish with @searchMessageComponent (this does seem to be missing from the documentation, but is still in the codebase)

The issue i’m seeing now, is that:

  • on focus, the component im trying to use is displayed and immediately closed.
  • clicking power-select, and holding the mouse button down, keeps the component open, until release of the mouse button
  • when manually opening the search input, through the public api (element.actions.open();) it works as it should.

I narrowed down the code that closes the addon to here: https://github.com/cibernox/ember-basic-dropdown/blob/b60127457821069cf288a7008c6ec2f787a69497/addon/components/basic-dropdown-content.js#L125

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
patricklxcommented, Feb 14, 2020

same issue for me… some change how did-insert works? or events in general might be handled faster? looks like it this document.addEventListener(this.rootEventType, this.handleRootMouseDown, true); (in basic-dropdown-content.js) is called during the onMouseDown event phase. So, afterwardsr onMouseClick gets invoked and runs that code and then closes it 😦 Adding a delay in the setup function would probably fix it (or after OnMouseClick/onMouseDown?)

edit: just noticed this is in basic dropdownedit: changed the eventType to click and now it works fine

1reaction
pjcarlycommented, Jan 3, 2020

I just removed it in my css stylesheet ¯\_(ツ)_/¯

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android keyboard closing on input focus - Stack Overflow
When the Android user in Chrome tap to fill a input on my form, the Keyboard appears but suddenly closes immediately. Not giving...
Read more >
Enter file name search popup is not closing itself after losing ...
The focus is losing this "Enter file name"(Either textbox should be empty or typed textbox value shouldn't have any result) popup, but not...
Read more >
Restoring ActiveElement Focus After A User-Interaction In ...
activeElement property to record which element triggered the modal. And then, when the user subsequently closes the modal window, we can call ....
Read more >
Window: afterprint event - Web APIs - MDN Web Docs - Mozilla
The afterprint event is fired after the associated document has started printing or the print preview has been closed.
Read more >
Understanding Flutter's keyboard focus system
Flutter comes with a focus system that directs the keyboard input to a ... The previouslyFocusedChild disposition will search the scope to find...
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