mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Merge pull request #16492 from atom/jr-fix-modal-tabbing
Allow you to tab through modal text box
This commit is contained in:
@@ -89,6 +89,22 @@ describe('TextEditorElement', () => {
|
||||
expect(element.getModel().getText()).toBe('testing')
|
||||
})
|
||||
|
||||
describe('tabIndex', () => {
|
||||
it('uses a default value of -1', () => {
|
||||
jasmineContent.innerHTML = '<atom-text-editor />'
|
||||
const element = jasmineContent.firstChild
|
||||
expect(element.tabIndex).toBe(-1)
|
||||
expect(element.querySelector('input').tabIndex).toBe(-1)
|
||||
})
|
||||
|
||||
it('uses the custom value when given', () => {
|
||||
jasmineContent.innerHTML = '<atom-text-editor tabIndex="42" />'
|
||||
const element = jasmineContent.firstChild
|
||||
expect(element.tabIndex).toBe(-1)
|
||||
expect(element.querySelector('input').tabIndex).toBe(42)
|
||||
})
|
||||
})
|
||||
|
||||
describe('when the model is assigned', () =>
|
||||
it("adds the 'mini' attribute if .isMini() returns true on the model", async () => {
|
||||
const element = buildTextEditorElement()
|
||||
|
||||
@@ -170,6 +170,7 @@ class TextEditorComponent {
|
||||
this.textDecorationBoundaries = []
|
||||
this.pendingScrollTopRow = this.props.initialScrollTopRow
|
||||
this.pendingScrollLeftColumn = this.props.initialScrollLeftColumn
|
||||
this.tabIndex = this.props.element && this.props.element.tabIndex ? this.props.element.tabIndex : -1
|
||||
|
||||
this.measuredContent = false
|
||||
this.queryGuttersToRender()
|
||||
@@ -681,7 +682,8 @@ class TextEditorComponent {
|
||||
scrollWidth: this.getScrollWidth(),
|
||||
decorationsToRender: this.decorationsToRender,
|
||||
cursorsBlinkedOff: this.cursorsBlinkedOff,
|
||||
hiddenInputPosition: this.hiddenInputPosition
|
||||
hiddenInputPosition: this.hiddenInputPosition,
|
||||
tabIndex: this.tabIndex
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3546,7 +3548,7 @@ class CursorsAndInputComponent {
|
||||
const {
|
||||
lineHeight, hiddenInputPosition, didBlurHiddenInput, didFocusHiddenInput,
|
||||
didPaste, didTextInput, didKeydown, didKeyup, didKeypress,
|
||||
didCompositionStart, didCompositionUpdate, didCompositionEnd
|
||||
didCompositionStart, didCompositionUpdate, didCompositionEnd, tabIndex
|
||||
} = this.props
|
||||
|
||||
let top, left
|
||||
@@ -3574,7 +3576,7 @@ class CursorsAndInputComponent {
|
||||
compositionupdate: didCompositionUpdate,
|
||||
compositionend: didCompositionEnd
|
||||
},
|
||||
tabIndex: -1,
|
||||
tabIndex: tabIndex,
|
||||
style: {
|
||||
position: 'absolute',
|
||||
width: '1px',
|
||||
|
||||
@@ -32,7 +32,7 @@ class TextEditorElement extends HTMLElement {
|
||||
createdCallback () {
|
||||
this.emitter = new Emitter()
|
||||
this.initialText = this.textContent
|
||||
this.tabIndex = -1
|
||||
if (this.tabIndex == null) this.tabIndex = -1
|
||||
this.addEventListener('focus', (event) => this.getComponent().didFocus(event))
|
||||
this.addEventListener('blur', (event) => this.getComponent().didBlur(event))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user