-
-
Notifications
You must be signed in to change notification settings - Fork 141
Close launcher button styling and close launcher with delete key #655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
e218736
wants to merge
8
commits into
jupyterlab:main
Choose a base branch
from
e218736:keyboard-navigation-tabbar
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
de0203c
Close launcher keyboard navigation/shortcut
e218736 9af3b7b
reverted formatting changes and styling of close launcher button
e218736 ec33691
revert formatting
e218736 c6b9998
removed console.log
e218736 bd0705f
Update tabbar.css
t03857785 2dfba44
changed bakground color to none
e218736 d7ba186
removed launcher caption and button padding
e218736 949c3a9
removed launcher caption and button padding
e218736 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -777,15 +777,28 @@ export class TabBar<T> extends Widget { | |
return; | ||
} | ||
|
||
// Get focus element that is in focus by the tab key | ||
const focusedElement = document.activeElement; | ||
// Check if Delete key has been pressed and Delete that tab | ||
if (event.key === 'Delete') { | ||
const index = ArrayExt.findFirstIndex(this.contentNode.children, tab => | ||
tab.contains(focusedElement) | ||
); | ||
if (index >= 0) { | ||
this.currentIndex = index; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this here? |
||
let title = this._titles[index]; | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
this._tabCloseRequested.emit({ index, title }); | ||
return; | ||
} | ||
} | ||
// Check if Enter or Spacebar key has been pressed and open that tab | ||
if ( | ||
event.key === 'Enter' || | ||
event.key === 'Spacebar' || | ||
event.key === ' ' | ||
) { | ||
// Get focus element that is in focus by the tab key | ||
const focusedElement = document.activeElement; | ||
|
||
// Test first if the focus is on the add button node | ||
if ( | ||
this.addButtonEnabled && | ||
|
@@ -808,6 +821,7 @@ export class TabBar<T> extends Widget { | |
} else if (ARROW_KEYS.includes(event.key)) { | ||
// Create a list of all focusable elements in the tab bar. | ||
const focusable: Element[] = [...this.contentNode.children]; | ||
|
||
if (this.addButtonEnabled) { | ||
focusable.push(this.addButtonNode); | ||
} | ||
|
@@ -1730,7 +1744,11 @@ export namespace TabBar { | |
let className = this.createIconClass(data); | ||
|
||
// If title.icon is undefined, it will be ignored. | ||
return h.div({ className }, title.icon!, title.iconLabel); | ||
return h.div( | ||
{ className, 'aria-hidden': 'true' }, | ||
title.icon!, | ||
title.iconLabel | ||
); | ||
} | ||
|
||
/** | ||
|
@@ -1741,7 +1759,14 @@ export namespace TabBar { | |
* @returns A virtual element representing the tab label. | ||
*/ | ||
renderLabel(data: IRenderData<any>): VirtualElement { | ||
return h.div({ className: 'lm-TabBar-tabLabel' }, data.title.label); | ||
return h.div( | ||
{ | ||
className: 'lm-TabBar-tabLabel', | ||
tabindex: '-1', | ||
'aria-hidden': 'true' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this |
||
}, | ||
data.title.label | ||
); | ||
} | ||
|
||
/** | ||
|
@@ -1752,7 +1777,9 @@ export namespace TabBar { | |
* @returns A virtual element representing the tab close icon. | ||
*/ | ||
renderCloseIcon(data: IRenderData<any>): VirtualElement { | ||
return h.div({ className: 'lm-TabBar-tabCloseIcon' }); | ||
return h.div({ | ||
className: 'lm-TabBar-tabCloseIcon' | ||
}); | ||
} | ||
|
||
/** | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.