stacker.news/lib/clicks.js
keyan 18910fa2ed Revert "shield your eyes; massive, squashed refactor; nextjs/react/react-dom/apollo upgrades"
This reverts commit d0314ab73c42ebf85fe2f418dddd681af45dbc55.
2023-07-23 09:16:12 -05:00

12 lines
577 B
JavaScript

export function ignoreClick (e) {
return e.target.onclick || // the target has a click handler
// the target has an interactive parent
e.target.matches(':where(.upvoteParent, .pointer, form, textarea, button, a, input) :scope') ||
// the target is an interactive element
['TEXTAREA', 'BUTTON', 'A', 'INPUT', 'FORM'].includes(e.target.tagName.toUpperCase()) ||
// the target is an interactive element
e.target.class === 'upvoteParent' || e.target.class === 'pointer' ||
// the click is caused by a selection
window.getSelection()?.toString()
}