I'm converting an application to be compliant with the W3 accessibility guidelines.
I need to have the screen reader to read the title and the value together, only using <p> tags.
This website has several forms which are displayed as read only and if the user wishes to edit the fields he must click an "Edit" button that will open a modal.
My problem with the read only fields is that this website is structured such that the titles are presented on the left and the respective values on the right. Something like this:
<div class="form-group" id="-serviceName">
<p id="-title" class="col-sm-4 form-control-title">Some text</p>
<p id="-value" class="col-sm-8 form-control-static">Some value</p>
</div>
Initially I was using <label> but as my value is not an input when I open the page WAVE evaluation tool was giving me an alert:
"Orphaned form label: A form label is present, but it is not correctly associated with a form control."
<div class="form-group" id="-serviceName">
<label class="col-sm-4 control-label" id="-label">Some text</label>
<div class="col-sm-8 col-md-6 col-lg-4">
<p class="form-control-static" id="-value">Some value</p>
</div>
</div>
I have tried to use aria-labeledby and aria-describedby, but using the arrow keys, the screen reader always presents the information independently.
First it reads "Some text" and then I have to click again on the arrow keys and it read "Some value".
I want to have the screen reader to read both values together as: "Some text Some value"
<p>elements, but then your next example includes a<div>and a<label>. Do you have control over the markup? Or does it have to be two<p>elements?