mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Add documentation to addModalPanel api
This commit is contained in:
@@ -178,12 +178,12 @@ describe('PanelContainerElement', () => {
|
||||
|
||||
it("focuses the first tabbable item if available", () => {
|
||||
const panel = createPanel()
|
||||
|
||||
const panelEl = panel.getElement()
|
||||
const inputEl = document.createElement('input')
|
||||
panelEl.appendChild(inputEl)
|
||||
|
||||
panelEl.appendChild(inputEl)
|
||||
expect(document.activeElement).not.toBe(inputEl)
|
||||
|
||||
panel.show()
|
||||
expect(document.activeElement).toBe(inputEl)
|
||||
})
|
||||
|
||||
@@ -51,7 +51,7 @@ class PanelContainerElement extends HTMLElement {
|
||||
if (this.model.isModal()) {
|
||||
this.hideAllPanelsExcept(panel)
|
||||
this.subscriptions.add(panel.onDidChangeVisible(visible => {
|
||||
if (visible) this.hideAllPanelsExcept(panel)
|
||||
if (visible) { this.hideAllPanelsExcept(panel) }
|
||||
}))
|
||||
|
||||
if (panel.autoFocus) {
|
||||
|
||||
@@ -1752,6 +1752,11 @@ module.exports = class Workspace extends Model {
|
||||
// (default: true)
|
||||
// * `priority` (optional) {Number} Determines stacking order. Lower priority items are
|
||||
// forced closer to the edges of the window. (default: 100)
|
||||
// * `autoFocus` (optional) {Boolean} true if you want modal focus managed for you by Atom.
|
||||
// Atom will automatically focus your modal panel's first tabbable element when the modal
|
||||
// opens and will restore the previously selected element when the modal closes. Atom will
|
||||
// also automatically restrict user tab focus within your modal while it is open.
|
||||
// (default: false)
|
||||
//
|
||||
// Returns a {Panel}
|
||||
addModalPanel (options = {}) {
|
||||
|
||||
Reference in New Issue
Block a user