Skip to content
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

Added aria-live announcement when a notebook cell is taking a long time to process. #15554

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

m158261
Copy link
Contributor

@m158261 m158261 commented Dec 21, 2023

References

Accessibility Issues Needing Addressing for WCAG 2.1 compliance (As of Version 2.2.6) - Extra Credit Issue Area # 1

Long waiting times or screens without text should inform the users with screen readers what the system is doing so they don’t think think it crashed or computer black screened (so they don’t turn restart their computer).

Code changes

I have added an aria-live region that appends to the main content panel as that is high up in the DOM and never hidden. When the user runs a notebook cell the kernel status changes to busy and a 10 second timer is set. If this timer expires, text is append to the live region which will be announced by a screen reader. If the timer does not reach the end it is cancelled when the kernel status changes back to idle.

User-facing changes

No visual changes. Users with screen readers will get an announcement that the kernel status is busy if a notebook cell takes more than 10 seconds to complete.

Backwards-incompatible changes

None

Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

@github-actions github-actions bot added pkg:application tag:CSS For general CSS related issues and pecadilloes Design System CSS labels Dec 21, 2023
this._busyCount++;
if (this.isBusy !== oldBusy) {
this._busySignal.emit(this.isBusy);
timeout = setTimeout(() => {
ariaLiveRegion!.append(
'A notebook cell is processing. Kernel status is busy.'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs translation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes made.

}
return new DisposableDelegate(() => {
const oldBusy = this.isBusy;
this._busyCount--;
clearTimeout(timeout);
ariaLiveRegion!.append('Processing complete. Kernel status is idle.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs translation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes made.

@m158261
Copy link
Contributor Author

m158261 commented Mar 28, 2024

I am unable to continue working on this PR after March 28, 2024. If further refinements are identified, I welcome any future contributors to pick up and progress the work.

ariaLiveRegion!.append(
trans.__('A notebook cell is processing. Kernel status is busy.')
);
}, 10000);
Copy link
Contributor

@gabalafou gabalafou Apr 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concern raised by @tonyfast, this timeout should be configurable

@@ -71,15 +72,28 @@ export class LabStatus implements ILabStatus {
*
* @returns A disposable used to clear the busy state for the caller.
*/
setBusy(): IDisposable {
setBusy(translator?: ITranslator): IDisposable {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not passed anywhere

const oldBusy = this.isBusy;
const ariaLiveRegion = document.getElementById('commands-aria-live');
let timeout: any;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let timeout: any;
let timeout: number;

Or ReturnType<typeof setInterval>

Comment on lines +85 to +87
ariaLiveRegion!.append(
trans.__('A notebook cell is processing. Kernel status is busy.')
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to clear the live region to avoid memory leak?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. an activity log or aria log will need to be cleared. over the course of an interactive computing session the activity will fill up, especially after hours of work. memory leaks are inevitable in these cases.

assertive aria live notifications will be announced immediately and may be cleared sooner while polite aria live messages linger until current speaking buffer clears. this AT buffer could be reading an entire page or post meaning that polite aria messages may take many minutes to be announced.
unfortunately, there is NO way to know when to clear the aria live buffer because the browser can't know when messages have reached assistive technology. for polite aria messages the buffer might need to persist for minutes maybe up tens of minutes; it is possible an aria live message will become stale if enough time and activity have elapsed. we can't make too many assumptions about time because for the varied ways disabled people experience crip time.

@tonyfast
Copy link
Contributor

tonyfast commented Apr 5, 2024

i dont have a good perspective of the jupyterlab issues anymore so i couldnt find issues about long running cells. maybe one of yall know better than me.

im wondering if this feature could be considered for ALL users, maybe it is a follow up issue. long running cells impose a cognitive inaccessibility that can distract different neurotypes from their task at hand. it is easy to forget the actions done in the past while a long running cell is executed. exposing visual and/or audible feedback for ALL users might be a direction this work could take us. is the long running cell the right feature to tether the aria live activity log to the toast notification system. when a long running cell completes maybe we hear a message that cells "cell xx in notebook yy completed after zz seconds. click here to return to the cell". considering this feature might help with "ensuring processes do not rely on memory"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants