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

feat: allow users to add arialabel to text input #5560

Merged
merged 2 commits into from
May 22, 2024

Conversation

akoreman
Copy link
Contributor

Issue #, if available:

Description of changes: Currently, the aria-label of the text input says Cursor at row x, some users might want to add context about their editor to this aria label. This change adds an option, textInputAriaLabel, which is used to create and aria-label as textInputAriaLabel, Cursor at row x.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Pull Request Checklist:

Copy link

One of the public type files has been updated, plase make sure there are no backwards incompatible changes done in the PR.

@@ -235,6 +235,7 @@ export namespace Ace {
relativeLineNumbers: boolean;
enableMultiselect: boolean;
enableKeyboardAccessibility: boolean;
textInputAriaLabel: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

So I guess nothing is optional here? Although everything is

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah all of the options are marked as mandatory, users using this type will likely have to use Partial<EditorOptions>.

Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -90,7 +90,8 @@ TextInput= function(parentNode, host) {
text.setAttribute("aria-roledescription", nls("text-input.aria-roledescription", "editor"));
if(host.session) {
var row = host.session.selection.cursor.row;
text.setAttribute("aria-label", nls("text-input.aria-label", "Cursor at row $0", [row + 1]));
var arialLabel = `${host.$textInputAriaLabel}, ${nls("text-input.aria-label", "Cursor at row $0", [row + 1])}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

should we hide "," if there is textInputAriaLabel is not there? Basically to cater for the initial value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah that's fair, changed

@@ -753,6 +753,18 @@ module.exports = {
assert.equal(editor.getValue(), "");
sendEvent("input", {key: {inputType: "historyRedo"}});
assert.equal(editor.getValue(), "x");
},

"test: text input aria label": function() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also add same test but without textInputAriaLabel being set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, added

Copy link

One of the public type files has been updated, plase make sure there are no backwards incompatible changes done in the PR.

Copy link

codecov bot commented May 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.67%. Comparing base (b3dfa11) to head (170a48e).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5560   +/-   ##
=======================================
  Coverage   86.66%   86.67%           
=======================================
  Files         593      593           
  Lines       42920    42940   +20     
  Branches     7125     7126    +1     
=======================================
+ Hits        37198    37218   +20     
  Misses       5722     5722           
Flag Coverage Δ
unittests 86.67% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@akoreman akoreman merged commit 8d7dfb6 into ajaxorg:master May 22, 2024
4 checks passed
@akoreman akoreman deleted the aria_label branch May 22, 2024 15:47
@akoreman akoreman restored the aria_label branch May 24, 2024 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants