WCAG requires every element with an ARIA role to only use ARIA attributes that are allowed for that role.
When elements with an ARIA role are using ARIA attributes that are not allowed, it can impact the accessibility of a page. The worst-case scenario is that the attribute will disable certain accessible functionality for portions of the page.
This means that assistive technology may provide users with incorrect information that isn’t in line with the UI of a page or document.
ARIA clearly outlines which attributes are allowed for specific roles and where attributes may be used.
ARIA attribute and role guidelines can be found here:
For passed and failed examples, visit W3C’s GitHub’s ATC Rules library.