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

Improve accessibility: use ng-repeat on <tr> instead of <tbody> #1045

Conversation

juanvallejo
Copy link
Contributor

@juanvallejo juanvallejo commented Dec 15, 2016

This patch repeats table rows rather than table bodies for any list of
data displayed in a table.

It also resolves the issue of a double top-border on tables when there are
nested ng-repeat loops. (In these cases, a double top border was
appearing due to the need for a sibling element to contain the
outer loop. This extra element caused the css rule "tbody > tr + tr" to
apply a top-border to the first visible element as well, making the
table's already existing top-border redundant).

deployments-table

@spadgett @jwforres @rhamilto @sg00dwin

> tr {
+ tr {
&:nth-child(2) {
border-top-width: 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rhamilto I was not sure if this was the correct approach to fixing the double border on tables that need a hidden <tr> before the actual first visible <tr> element. wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

I think @sg00dwin is probably a better qualified as I know he has recently fixed some stuff in _tables.less.

@juanvallejo juanvallejo force-pushed the jvallejo/move-ng-repeat-from-tbody-to-tr branch from b857d10 to bde4c28 Compare December 19, 2016 21:26
border-top-width: 0;
}
> tr.nested-loop ~ tr.nested-loop {
border-top-width: 2px;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sg00dwin @jwforres @spadgett
This works for all cases where there must be sibling elements (with the first one set to display: none;) in order to have nested loops (traffic-table.html and deployments.html in this PR). I first remove the border from all <tr> elements in the loop, and then re-apply it to every <tr> in that loop except the first one by using tr.nested-loop ~ tr.nested-loop.

Copy link
Member

Choose a reason for hiding this comment

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

I guess I'm not clear on why there is a top border on the first hidden row. If display: none, shouldn't the border be hidden as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@spadgett

The border comes from the first non-hidden <tr> (with className nested-loop) (see attached image), but normally, this first non-hidden <tr> would not have a border-top-width due to the css rule tbody > tr + tr {... which would only apply the border to <tr> tags that immediately follow other <tr> tags. Normally the top 2px border that is seen, is the overall <table> element's top-border. Because the hidden <tr> right above the one in the image still exists in the dom, it forces this first visible <tr> to have a border-top-width, which combined with the table's existing 2px results in the top border with extra width that we are currently seeing in these tables.

To get around this, I select all non-hidden <tr> elements by adding the class nested-loop to them, remove their border-top-width, and then re-apply it to every one except the first .nested-loop tr.

service-page-first-element-w-class

@juanvallejo juanvallejo force-pushed the jvallejo/move-ng-repeat-from-tbody-to-tr branch from bde4c28 to 5009a3a Compare December 19, 2016 21:59
@spadgett
Copy link
Member

Does it work if we change the ng-repeat-start to just ng-repeat and remove the hidden ng-repeat-end table rows?

@juanvallejo
Copy link
Contributor Author

juanvallejo commented Dec 21, 2016

@spadgett

Does it work if we change the ng-repeat-start to just ng-repeat and remove the hidden ng-repeat-end table rows?

I have tested this on both imagestream.html, and deployments.html and it only seems to work in imagestreams.html. I have updated imagestreams.html in the latest commit 58a95e4.

@juanvallejo juanvallejo force-pushed the jvallejo/move-ng-repeat-from-tbody-to-tr branch from 58a95e4 to 2a75699 Compare December 21, 2016 15:42
Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

@juanvallejo looks good, please squash your commits and I'll merge

This patch repeats table rows rather than table bodies for any list of
data displayed in a table.

It resolves the issue of a double top-border on tables when there are
nested ng-repeat loops. (In these cases, a double top border was
appearing due to the need for a sibling <tr> element to contain the
outer loop. This extra element caused the css rule "tbody > tr + tr" to
apply a top-border to the first visible <tr> element as well, making the
table's already existing top-border redundant).

This patch removes the `<table>` element's top border and adds it
instead to all nested `<tr>` elements in mobile view.
@juanvallejo juanvallejo force-pushed the jvallejo/move-ng-repeat-from-tbody-to-tr branch from 2a75699 to 0874897 Compare December 21, 2016 19:22
@juanvallejo
Copy link
Contributor Author

@spadgett

@juanvallejo looks good, please squash your commits and I'll merge

Thanks! done

@spadgett
Copy link
Member

[merge]

@openshift-bot
Copy link

Evaluated for origin web console merge up to 0874897

@openshift-bot
Copy link

openshift-bot commented Dec 21, 2016

Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin_web_console/880/) (Base Commit: e66c5ad)

@openshift-bot openshift-bot merged commit 0279eec into openshift:master Dec 21, 2016
@juanvallejo juanvallejo deleted the jvallejo/move-ng-repeat-from-tbody-to-tr branch December 21, 2016 19:47
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

4 participants