diff --git a/src/__tests__/role.js b/src/__tests__/role.js
index c7dc70c5..31125a3f 100644
--- a/src/__tests__/role.js
+++ b/src/__tests__/role.js
@@ -572,3 +572,44 @@ test('should find the input using type property instead of attribute', () => {
const {getByRole} = render('')
expect(getByRole('textbox')).not.toBeNull()
})
+
+describe('Web Component Custom Elements', () => {
+ beforeAll(() => {
+ customElements.define(
+ 'custom-button',
+ class CustomButton extends HTMLElement {
+ constructor() {
+ super()
+
+ this.attachShadow({mode: 'open'})
+
+ const button = document.createElement('button')
+ button.innerHTML = 'Button text'
+
+ this.shadowRoot.append(button)
+ }
+ },
+ )
+ })
+
+ test('should find accessible roles in elements that contain a shadowRoot', () => {
+ const {getByRole} = render(`