Commit Graph

13 Commits

Author SHA1 Message Date
Will Binns-Smith
128f702784 Add documentation to addModalPanel api 2017-08-22 23:14:54 -07:00
Will Binns-Smith
e8913660fa Make autoFocus opt-in 2017-08-22 23:10:14 -07:00
Will Binns-Smith
7da76ec50d Remove semicolons :'( 2017-08-22 23:10:14 -07:00
Will Binns-Smith
0916b4c4f0 Manage focus for modal panels
This implements automatic focus management for modal panels using the
excellent focus-trap module.

Upon being shown, modals will have their first tabbable element
automatically focused, and shifting focus with the tab key (or more
correctly the core:focus-next command) will be limited to the contents
of the modal. If the modal does not have any tabbable elements, focus()
will be sent to the panel's root element (if it implements it).

I'm happy to update this to *always* calls focus on the panel's root
element, but then modal implementers would need to handle that and
focus things on their own. I'd argue the tabbable element behavior
is more accessible though :)

This has the effect of not automatically closing most of Atom's own
modals whenever the tab key is pressed, which was an odd nonstandard
behavior, IMO.

This also automates returning focus to the element that had focus before
the modal was shown, something up until now had to be implemented in
every modal in Atom.

This likely breaks a few contracts for existing Atom packages that
create modals, but I've found this doesn't conflict behaviorally with
well-behaved modals like the command palette which implement their own
focus management (which can be removed if this lands).

Released under CC0.
2017-08-22 23:09:44 -07:00
Will Binns-Smith
882a1924f0 Remove one-off eslint global pragmas in favor of envs 2017-08-20 19:55:00 -07:00
Max Brunsfeld
1c6c38e8a8 Ensure that atom-panel tags can be created via HTML
* Remove the PanelElement custom element
* Convert Panel and its test to JavaScript
2017-04-10 16:22:51 -07:00
Max Brunsfeld
d1e8e359ce Add PanelContainer.getElement, remove PanelContainer view provider 2017-04-05 16:03:33 -07:00
Matthew Dapena-Tretter
13f0c8a977 Docks: define handle size in CSS; measure in JS 2017-03-27 12:19:08 -07:00
Matthew Dapena-Tretter
98e7fcc505 Prefer getElement() to view registry for Docks, PaneContainer & Pane 2017-03-20 22:39:23 -07:00
Matthew Dapena-Tretter
bf39947eee Add Dock component 2017-03-18 15:31:51 -07:00
Matthew Dapena-Tretter
d6a354d6ba Convert panel container to JS: Cleanup 2017-03-07 14:52:32 -08:00
Matthew Dapena-Tretter
f56865b6f8 Convert panel container to JS: Lint 2017-03-07 14:30:33 -08:00
Matthew Dapena-Tretter
228b24b68b Convert panel container to JS: Decaffeinate 2017-03-07 14:20:27 -08:00