Merge pull request #987 from Safelite/feature/richardson/INSR-7917

Updates for sub caption on textbox
This commit is contained in:
brich1212safe 2025-12-18 14:10:09 -05:00 committed by GitHub
commit 19c34ac240
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 22 additions and 4 deletions

View file

@ -686,7 +686,7 @@ describe('TextboxQuestion', () => {
}); });
// Assert // Assert
expect(wrapper.vm.questionText).toBe(cmsContent); expect(wrapper.vm.questionTextForAria).toBe(cmsContent);
}); });
describe('"value" should', () => { describe('"value" should', () => {
test('get the modelValue prop', () => { test('get the modelValue prop', () => {

View file

@ -5,7 +5,7 @@
<label <label
v-if="displayQuestionText" v-if="displayQuestionText"
:for="inputId" :for="inputId"
:aria-label="questionText" :aria-label="questionTextForAria"
class="form-label" class="form-label"
:class="[questionAlignment === 'center' ? 'text-center w-100 mb-5' : '']" :class="[questionAlignment === 'center' ? 'text-center w-100 mb-5' : '']"
v-html="questionText"></label> v-html="questionText"></label>
@ -29,7 +29,7 @@
:aria-disabled="isDisabled" :aria-disabled="isDisabled"
:disabled="isDisabled" :disabled="isDisabled"
:aria-required="isRequired" :aria-required="isRequired"
:aria-label="questionText" :aria-label="questionTextForAria"
:min="min" :min="min"
:max="max" :max="max"
:required="isRequired" :required="isRequired"
@ -72,6 +72,7 @@
<script> <script>
import { useField, validate } from 'vee-validate'; import { useField, validate } from 'vee-validate';
import { extractSpanText } from '@/helpers/text-helper';
export default { export default {
name: 'textbox-question', name: 'textbox-question',
@ -154,6 +155,9 @@ export default {
questionText() { questionText() {
return this.getCmsContent(this.cmsWidgetName, 'QuestionText'); return this.getCmsContent(this.cmsWidgetName, 'QuestionText');
}, },
questionTextForAria() {
return extractSpanText(this.getCmsContent(this.cmsWidgetName, 'QuestionText'));
},
value: { value: {
get() { get() {
return this.modelValue; return this.modelValue;

View file

@ -10,6 +10,12 @@ export function stripRteStyle(stringWithStyleTag) {
return stringWithStyleTag.replace(regexExp, ''); return stringWithStyleTag.replace(regexExp, '');
} }
export function extractSpanText(spanElement) {
const tempContainer = document.createElement('div');
tempContainer.innerHTML = spanElement;
return tempContainer.textContent || tempContainer.innerText || '';
}
/** /**
* @function createOrderedListFromStringOfParagraphs * @function createOrderedListFromStringOfParagraphs
* @summary * @summary

View file

@ -151,7 +151,7 @@
cmsWidgetName="HelpTextWidget" cmsWidgetName="HelpTextWidget"
linkType="navigation" linkType="navigation"
href="javascript:void(0)" href="javascript:void(0)"
class="mt-3 text-left" class="mb-5 text-left"
@clickEvent="handleHelpLinkClick" /> @clickEvent="handleHelpLinkClick" />
</div> </div>
</div> </div>

View file

@ -170,6 +170,14 @@ body {
width: 58.33333333%; width: 58.33333333%;
} }
} }
div.textbox-question {
label {
span.sub-caption {
font-weight: 400;
}
}
}
} }
:root { :root {