I have an e-commerce shop page in development, where there is a button with the word "filter" on it, that when clicked, pops up a filter modal to the user. In the top of the filter modal is a heading with the text "filter" on it.
<button>Filter</button>
<div class="modal">
<h2>Filter</h2>
</div>
I have read about accessible names and it says that if two things have the same accessible name, it should do the same thing. But in this case, the auto-generated name for the filter button will be the same as the filter title even though they have different functionalities (one is a functional button, other is just a heading for display).
My question:
- Is it okay for two elements with different roles and functionality to have the same accessible name?
- If not, how do I change my DOM to highlight the difference?