You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a html component, where btn-good will pass the contrast checks, but btn-bad fails them (I am testing them independently in another story):
<buttonclass="btn-good" onclick="modal1.showModal()">Open Modal</button><dialogid="modal1" class="modal-no-backdrop"><divclass="modal-box"><h3class="modal-title">Modal with No Backdrop, No Click Away</h3><divclass="modal-body"><p>This is a simple modal that can only be closed using the button below</p></div><divclass="modal-action"><formmethod="dialog"><buttonclass="btn-bad">Close Modal</button></form></div></div></dialog>
Visually, the modal looks like this when opened:
I have created a story to test it with, and configured it to successfully open the modal when the story loads.
importMyModal"../components/modals/MyModal.html"exportdefault{title: 'Modals',parameters: {a11y: {config: {},},},decorators: [(story)=>{// Open modal after story renderssetTimeout(()=>{constmodalId=story().getAttribute('data-modal-id');constdialog=document.getElementById(modalId);if(dialog)dialog.showModal();},0);returnstory();}]};exportconstMyModalTest=()=>{constwrapper=document.createElement('div');wrapper.setAttribute('data-modal-id','modal1');wrapper.innerHTML=MyModal;setTimeout(()=>{constdialog=document.getElementById('modal1');if(dialog)dialog.showModal();},100);returnwrapper;};MyModalTest.storyName='Modal Test';
However, even with it loading and showing the inaccessible button, the tests are still passing. How can I make sure that the a11y test will evaluate the content of my modal.
If anyone is aware of a way to do this, then I would love to hear it!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
I have a html component, where
btn-good
will pass the contrast checks, butbtn-bad
fails them (I am testing them independently in another story):Visually, the modal looks like this when opened:
I have created a story to test it with, and configured it to successfully open the modal when the story loads.
However, even with it loading and showing the inaccessible button, the tests are still passing. How can I make sure that the a11y test will evaluate the content of my modal.
If anyone is aware of a way to do this, then I would love to hear it!
Additional information
No response
Create a reproduction
No response
Beta Was this translation helpful? Give feedback.
All reactions