Skip to content

Commit 708d4bf

Browse files
committed
Permit markup on prev/next session context buttons
Previously, if a button was customized to have child DOM elements, such as: ```html <a href="..." data-context-href="..."><span>Text</span></a> ``` it would not receive the intended behavior. Becuase the click target would be a child element (the span in this case), not the element with the required dataset attributes
1 parent 34eccf5 commit 708d4bf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/javascript/blacklight-frontend/search_context.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const SearchContext = (e) => {
2-
if (e.target.matches('[data-context-href]')) {
3-
SearchContext.handleSearchContextMethod.call(e.target, e)
2+
const contextLink = e.target.closest('[data-context-href]')
3+
if (contextLink) {
4+
SearchContext.handleSearchContextMethod.call(contextLink, e)
45
}
56
}
67

0 commit comments

Comments
 (0)