You can write xpath for any attribute present in the HTML tag; aria-label has been used to help visually impaired people. We can write xpath to aria labels as if it is an ID or a class.
<button aria-label="Close" onclick="myDialog.close()">X</button>
Xpath : //button[@aria-label='Close']