[ui] Keyboard shortcuts for widening and narrowing task sidebar (#15807)

* keyboard-commands helper to add widen and narrow commands

* Percy flake fix
This commit is contained in:
Phil Renaud 2023-01-17 12:08:41 -05:00 committed by GitHub
parent 4e82c96d36
commit a30a7e6bdf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

View file

@ -89,6 +89,11 @@
type="button" type="button"
{{on "click" this.toggleWide}} {{on "click" this.toggleWide}}
> >
{{#if this.wide}}
{{keyboard-commands (array this.narrowCommand)}}
{{else}}
{{keyboard-commands (array this.widenCommand)}}
{{/if}}
{{x-icon (if this.wide "arrow-right" "arrow-left")}} {{x-icon (if this.wide "arrow-right" "arrow-left")}}
</button> </button>
</div> </div>

View file

@ -16,6 +16,18 @@ export default class TaskContextSidebarComponent extends Component {
}, },
]; ];
narrowCommand = {
label: 'Narrow Sidebar',
pattern: ['ArrowRight', 'ArrowRight'],
action: () => this.toggleWide(),
};
widenCommand = {
label: 'Widen Sidebar',
pattern: ['ArrowLeft', 'ArrowLeft'],
action: () => this.toggleWide(),
};
@tracked wide = false; @tracked wide = false;
@action toggleWide() { @action toggleWide() {
this.wide = !this.wide; this.wide = !this.wide;

View file

@ -85,7 +85,10 @@ module('Acceptance | task logs', function (hooks) {
.dom('.task-context-sidebar h1.title') .dom('.task-context-sidebar h1.title')
.includesText(task.state, 'Task state is correctly displayed'); .includesText(task.state, 'Task state is correctly displayed');
await percySnapshot(assert, { await percySnapshot(assert, {
percyCSS: '.allocation-row td { display: none; }', percyCSS: `
.allocation-row td { display: none; }
.task-events table td:nth-child(1) { color: transparent; }
`,
}); });
await click('.sidebar button.close'); await click('.sidebar button.close');