-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
RevisionGrid: Set accessibility values #9887
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
Conversation
for message and commit id columns
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have not checked accessibility
public override void OnCellFormatting(DataGridViewCellFormattingEventArgs e, GitRevision revision) | ||
{ | ||
// Set the grid cell's accessibility text | ||
if (!revision.IsArtificial) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why limit artificial?
Is this displayed somewhere other than for accessibility?
(I do not see that when commenting out the test.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why limit artificial?
We do not want to display "111...1" anywhere.
Is this displayed somewhere other than for accessibility? (I do not see that when commenting out the test.)
No, it isn't. OnCellPainting
draws the cell. I have just restored setting e.Value
, which was removed by mistake in #8550.
I don't think this change is addressing the original issue as the accessible name value remains "Message Zeile 2". |
@vladimir-krestov @SergeySmirnov-Akvelon @guybark do you think you could give us a hand here? I struggle to find a way to override |
I tried the following, and it didn't work: diff --git a/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs b/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs
index 51c1561cc..aed592d60 100644
--- a/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs
+++ b/GitUI/UserControls/RevisionGrid/RevisionGridControl.cs
@@ -345,6 +345,8 @@ internal bool MultiSelect
set => _gridView.MultiSelect = value;
}
+ internal DataGridViewCell GetCell(int row, int column) => _gridView.Rows[row].Cells[column];
+
private static void FillMenuFromMenuCommands(IEnumerable<MenuCommand> menuCommands, ToolStripDropDownItem targetItem) diff --git a/GitUI/UserControls/RevisionGrid/Columns/CommitIdColumnProvider.cs b/GitUI/UserControls/RevisionGrid/Columns/CommitIdColumnProvider.cs
index c1ba632c5..ea3d58350 100644
--- a/GitUI/UserControls/RevisionGrid/Columns/CommitIdColumnProvider.cs
+++ b/GitUI/UserControls/RevisionGrid/Columns/CommitIdColumnProvider.cs
@@ -37,6 +37,8 @@ public CommitIdColumnProvider(RevisionGridControl grid)
public override void OnCellPainting(DataGridViewCellPaintingEventArgs e, GitRevision revision, int rowHeight, in CellStyle style)
{
+ DataGridViewCell cell = _grid.GetCell(e.RowIndex, e.ColumnIndex);
+
var monospaceFont = style.MonospaceFont;
if (!_widthByLengthByFont.TryGetValue(monospaceFont, out var widthByLength))
{
@@ -51,11 +53,19 @@ public override void OnCellPainting(DataGridViewCellPaintingEventArgs e, GitRevi
if (i == -1 && Column.Width > widthByLength[widthByLength.Length - 1])
{
- _grid.DrawColumnText(e, revision.ObjectId.ToString(), monospaceFont, style.ForeColor, e.CellBounds, useEllipsis: false);
+ string hash = revision.ObjectId.ToString();
+ cell.AccessibilityObject.Name = hash;
+ cell.AccessibilityObject.Value = hash;
+
+ _grid.DrawColumnText(e, hash, monospaceFont, style.ForeColor, e.CellBounds, useEllipsis: false);
}
else if (i > 1)
{
- _grid.DrawColumnText(e, revision.ObjectId.ToShortString(i - 1), monospaceFont, style.ForeColor, e.CellBounds, useEllipsis: false);
+ string hash = revision.ObjectId.ToShortString(i - 1);
+ cell.AccessibilityObject.Name = hash;
+ cell.AccessibilityObject.Value = hash;
+
+ _grid.DrawColumnText(e, hash, monospaceFont, style.ForeColor, e.CellBounds, useEllipsis: false);
}
}
} IIUIC, any descendant of |
The issue description was unclear / confusing: #9852 (comment). The @justanotheranonymoususer, please confirm whether https://ci.appveyor.com/api/buildjobs/cqfaxktufd5d845u/artifacts/artifacts%2FRelease%2Fpublish%2FGitExtensions-Portable-4.0.0.13552-f95404ed5.zip works for you. |
Yes, now it works as before. I still get "Message Row xxx" which I'd
rather not get, but I also get the actual text which is what's
important.
|
Hi @RussKie. I was able to do this using inherited classes.
|
Thank you, @SergeySmirnov-Akvelon! So, @justanotheranonymoususer, which properties should be set how? E.g.:
|
Looking at other elements, e.g. browser tabs, taskbar button, I see
that Name is set, and Value and Description are empty or not
implemented. Thanks.
|
Thank you @SergeySmirnov-Akvelon! @mstv @justanotheranonymoususer: according to the docs, So based on this information, I'd say for a row
...and each cell would have the following:
We also have branches and tags information, and I'm not sure how these should be presented, i.e., should they be announced at the row level or the cell level? The above is a description of a desired state, and I don't expect this to be implemented in this PR. We can start with the select columns and set the properties at the cell level. Thoughts? |
As I said, I'd rather have only the content and not have "Commit Row 123"
at all. That's also what I see in most other programs. They don't say
"taskbar button" or "browser tab", they just have the content in "Name" or
"Value", e.g. "Notepad" or "Google Search". "Description" is usually not
set at all, and usually only one of "Name" or "Value" is used.
I think it's better to look at popular programs and parts of the OS and see
what they implement. I think it's a better guide than the docs, since
that's what tools work with and optimized for in practice.
|
because it contained redundant information
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me if works for users with accessibility needs.
Thank you for doing this.
Fixes #9852
Proposed changes
Value
forRevisionGrid
columns:Name
of allRevisionGrid
cellsbecause it contained redundant information "Message Row nnn"
Screenshots
Before
After
Test methodology
Test environment(s)
Merge strategy
I agree that the maintainer squash merge this PR (if the commit message is clear).
✒️ I contribute this code under The Developer Certificate of Origin.