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

improvement: update umb-tabs to use better semantic markup #7926

Conversation

MMasey
Copy link
Contributor

@MMasey MMasey commented Apr 10, 2020

This PR improves the markup for the umb-tab used for example in the settings dashboard.

The old version of the code was using anchor tags etc when it should have been using buttons. I've also added some screen reader only text for the more options toggle when on a narrower screen.

The outcome itself visually is minimal, other than only showing the focus state when using the keyboard to navigate via tabbing.

settings-dashboard-improvement

MMasey and others added 2 commits April 10, 2020 14:38
# Conflicts:
#	src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
#	src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
Copy link
Member

@nul800sebastiaan nul800sebastiaan left a comment

Choose a reason for hiding this comment

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

@MMasey Thanks! I have left some comments around buttons, you can accept them if you agree!

<li ng-click="vm.clickTab($event, tab)" class="umb-tab" role="tab" aria-selected="true" tabindex="0" ng-repeat="tab in vm.tabs | limitTo: vm.maxTabs" data-element="tab-{{tab.alias}}" ng-class="{'umb-tab--active': tab.active, 'umb-tab--error': tabHasError}" val-tab>
<a>{{ tab.label }}</a>
<li class="umb-tab" ng-repeat="tab in vm.tabs | limitTo: vm.maxTabs" data-element="tab-{{tab.alias}}" ng-class="{'umb-tab--active': tab.active, 'umb-tab--error': tabHasError}" val-tab>
<button class="btn-reset umb-tab-button" ng-click="vm.clickTab($event, tab)" role="tab" aria-selected="{tab.active}">{{ tab.label }}</button>
Copy link
Member

Choose a reason for hiding this comment

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

Remember any buttons without a type attribute will just submit whatever form it might be in, need to always specify type="button".

Suggested change
<button class="btn-reset umb-tab-button" ng-click="vm.clickTab($event, tab)" role="tab" aria-selected="{tab.active}">{{ tab.label }}</button>
<button type="button" class="btn-reset umb-tab-button" ng-click="vm.clickTab($event, tab)" role="tab" aria-selected="{tab.active}">{{ tab.label }}</button>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah good catch, i've updated the PR.

@MMasey
Copy link
Contributor Author

MMasey commented Apr 10, 2020

I just realised that you had done a change request, not just comments 😂 Either way, it should be sorted now.

Copy link
Contributor

@emmaburstow emmaburstow left a comment

Choose a reason for hiding this comment

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

This doesn't break anything. Thanks for the changes Mike!

@nul800sebastiaan nul800sebastiaan merged commit 23e32d2 into umbraco:v8/contrib Apr 10, 2020
@nul800sebastiaan
Copy link
Member

Sweet, thanks for the update @MMasey no worries about not spotting the changes suggestions! 🍻

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.

3 participants