I'm trying to make a Modal component with React & TypeScript, which has a "click outside to close" functionality; I'm trying to implement that by making a backdrop element: a greyed out HTML div element as a background that has an onClick event that calls the onClose method.
The problem is that when I assign an onClick event on the backdrop element, I get the linting error: Static HTML elements with event handlers require a role.
And when I give it a role of an interactive element, like button for instance, I get these other errors:
A control must be associated with a text label.Elements with the 'button' interactive role must be focusable.
So my question is, what is the correct role to give to the backdrop element, and what should the other related attributes be?
P.S. I'm not interested in disabling the linting rule.