I have the requirement, to show a dialog, which integrates some inputs from the background (not all), as it enhances their functionality. So I want them to blend through to the dialog and be editable from there. This is not very hard to do with z-index, but the inputs must be outside of the dialog markup. I wonder if this works for a screen reader (my guess is it does not) and if not: Do you have any suggestions how I could make this work, without adjusting every input of the whole form?
Here is an example of what I'd like to accomplish in an accessible way:
function showDialog()
{
document.getElementById("dialog").style.display = 'table';
}
function hideDialog()
{
document.getElementById("dialog").style.display = 'none';
}
form > div
{
margin: 10px;
}
.layer
{
margin: 0;
position: fixed;
z-index: 1000;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
}
.showThrough
{
position: relative;
z-index: 1100;
}
<form>
<div class="showThrough">
<label>Input 1:</label><input/>
</div>
<div>
<label>Input 2:</label><input/>
</div>
<div class="showThrough">
<label>Input 3:</label><input class="showThrough"/>
</div>
<input type="button" onclick="showDialog()" value="Show dialog"/>
<input type="button" value="Submit"/>
<div id="dialog" role="dialog" class="layer" style="display: none;">
<input type="button" value="Close" onclick="hideDialog()"
style="position: absolute; bottom: 15px; right: 15px;"/>
</div>
</form>