Replace in-place links with buttons#2196
Conversation
tdonohue
left a comment
There was a problem hiding this comment.
@LotteHofstede : Overall the changes look good. But, I'm noticing that the searchbox in the header is now misaligned...and the search icon in the header seems to have moved further away from the globe (just more whitespace between them).
I'm testing in production mode (yarn build:prod; yarn serve:ssr).
I thought it might be a cached stylesheet at first, but tried in several browsers (Chrome and Firefox) and see the same in both. I also did a complete rebuild (including a yarn clean) and still see the same behavior.
|
@tdonohue Thanks for the review! The issue was caused by the fact that I renamed a custom CSS class but forgot to change it in the HTML for that particular instance. It should be fixed now! |
tdonohue
left a comment
There was a problem hiding this comment.
@LotteHofstede : Looks good now overall! And the CSS issues are fixed on my end.
However, I found one last (very minor) accessibility issue. We have a new <button> that has no text to describe it. It should be quick to fix (see comment below).
| formControlName="query" type="text" placeholder="{{searchExpanded ? ('nav.search' | translate) : ''}}" | ||
| class="d-inline-block bg-transparent position-absolute form-control dropdown-menu-right p-1" [attr.data-test]="'header-search-box' | dsBrowserOnly"> | ||
| <a class="submit-icon" [routerLink]="" (click)="searchExpanded ? onSubmit(searchForm.value) : expand()" [attr.data-test]="'header-search-icon' | dsBrowserOnly"> | ||
| <button class="submit-icon btn btn-link btn-link-inline" aria-label="Submit search" type="button" (click)="searchExpanded ? onSubmit(searchForm.value) : expand()" [attr.data-test]="'header-search-icon' | dsBrowserOnly"> |
There was a problem hiding this comment.
@LotteHofstede : Sorry, I should have been more clear. This aria-label should use an i18n key (e.g. the existing nav.search or a new key if you'd rather), so that it can be easily translated.
So, I think this needs to be something like:
[attr.aria-label]="'nav.search' | translate"
Otherwise, our accessibility label can only ever be in English.
This is the same way that all other navbar buttons (login, etc) have translatable ARIA labels (see auth-nav-menu.component.html for example).
tdonohue
left a comment
There was a problem hiding this comment.
👍 Thanks @LotteHofstede ! This looks good to me now & verified it works and passes accessibility checks.


References
Description
This PR replaces instances of empty/in-place links with buttons
Instructions for Reviewers
Compare the following links/buttons before and after this PR:
Checklist
yarn lintyarn check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.