Socket
Socket
Sign inDemoInstall

atom-select-list

Package Overview
Dependencies
Maintainers
7
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atom-select-list - npm Package Compare versions

Comparing version 0.7.1 to 0.7.2

2

package.json
{
"name": "atom-select-list",
"version": "0.7.1",
"version": "0.7.2",
"description": "A general-purpose select list for use in Atom packages",

@@ -5,0 +5,0 @@ "main": "./src/select-list-view.js",

@@ -57,8 +57,8 @@ # atom-select-list

* (Optional) `itemsClassList: [String]`: an array of strings that will be added as class names to the items element.
* (Optional) `initialSelectionIndex: Number`: the index of the item to initially select and automatically select after query changes; defaults to 0.
* (Optional) `initialSelectionIndex: Number`: the index of the item to initially select and automatically select after query changes; defaults to `0`.
* (Optional) `didChangeQuery: (query: String) -> Void`: a function that is called when the query changes.
* (Optional) `didChangeSelection: (item: Object) -> Void`: a function that is called when the selected item changes.
* (Optional) `didConfirmSelection: (item: Object) -> Void`: a function that is called when the user clicks or presses enter on an item.
* (Optional) `didConfirmSelection: (item: Object) -> Void`: a function that is called when the user clicks or presses <kbd>Enter</kbd> on an item.
* (Optional) `didConfirmEmptySelection: () -> Void`: a function that is called when the user presses <kbd>Enter</kbd> but the list is empty.
* (Optional) `didCancelSelection: () -> Void`: a function that is called when the user presses <kbd>Esc</kbd> or the list loses focus.
* (Optional) `initiallyVisibleItemCount: Number`: When this options was provided, `SelectList` observe visibility of items in viewport, visibility state is passed as `visible` option to `elementForItem`. This is mainly used to skip heavy computation for invisible items.

@@ -34,2 +34,13 @@ const {Disposable, CompositeDisposable, TextEditor} = require('atom')

editorElement.addEventListener('blur', didLoseFocus)
// When clicking the scrollbar of the items list, a blur event will be triggered
// on the query editor element, but we don't want to treat that as a cancellation.
// This mousedown listener allows us to detect this case and restore focus to the
// query editor. This is based on https://stackoverflow.com/a/1480178.
this.didClickItemsList = false
this.element.addEventListener('mousedown', event => {
if (event.target === this.refs.items) {
this.didClickItemsList = true
}
})
this.disposables.add(new Disposable(() => { editorElement.removeEventListener('blur', didLoseFocus) }))

@@ -58,3 +69,4 @@ }

didLoseFocus (event) {
if (this.element.contains(event.relatedTarget)) {
if (this.didClickItemsList || this.element.contains(event.relatedTarget)) {
this.didClickItemsList = false
this.refs.queryEditor.element.focus()

@@ -61,0 +73,0 @@ } else if (document.hasFocus()) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc