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

Hover over dropdown menu #2145

Merged
merged 1 commit into from
Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions src/js/widgets/list_of_things/item_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ define([
'mouseenter .letter-icon': 'showLinks',
'mouseleave .letter-icon': 'hideLinks',
'focusout .letter-icon': 'hideLinks',
'click .letter-icon a': 'emitAnalyticsEvent',
'click .letter-icon': 'toggleShowLinksWithClick',
'click .show-all-authors': 'showAllAuthors',
'click .show-less-authors': 'showLessAuthors',
// only relevant to results view for the moment
Expand Down Expand Up @@ -204,12 +204,25 @@ define([
}
},

toggleShowLinksWithClick: function(e) {
// only allows open drop down with click using mobile
// in desktop, mouse over will show dropdown
if (this.model.get('isMobileOrTablet')) {
thostetler marked this conversation as resolved.
Show resolved Hide resolved
if (
$(e.currentTarget)
.find('ul')
.hasClass('hidden')
) {
this.showLinks(e);
} else {
this.hideLinks(e);
}
}
},

showLinks: function(e) {
var $c = $(e.currentTarget);
if (
!$c.find('.active-link').length ||
this.model.get('isMobileOrTablet')
) {
if (!$c.find('.active-link').length) {
return;
}

Expand Down
6 changes: 3 additions & 3 deletions src/js/widgets/list_of_things/templates/item-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

{{#if links.text}}

<a href="{{links.text.[0].url}}" target="_blank" rel="noreferrer noopener" class="btn-link active-link s-active-link" aria-disabled="false">
<a class="btn-link active-link s-active-link" aria-disabled="false">
<i class="s-text-icon" aria-hidden="true"></i>
<span class="sr-only">quick access to full text links</span>
</a>
Expand Down Expand Up @@ -81,7 +81,7 @@

{{#if links.list}}

<a href="{{links.list.[0].url}}" class="btn-link active-link s-active-link" aria-disabled="false">
<a class="btn-link active-link s-active-link" aria-disabled="false">
<i class="s-list-icon" aria-hidden="true"></i>
<span class="sr-only">quick links to lists of references, citations and more</span>
</a>
Expand Down Expand Up @@ -109,7 +109,7 @@

{{#if links.data}}

<a href="{{links.data.[0].url}}" target="_blank" rel="noreferrer noopener" class="btn-link active-link s-active-link" aria-disabled="false">
<a class="btn-link active-link s-active-link" aria-disabled="false">
<i class="s-data-icon" aria-hidden="true"></i>
<span class="sr-only">quick links to data associated with this article</span>
</a>
Expand Down