-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add helper text API and slot #410
Conversation
1aa4b72
to
e271e22
Compare
98d9767
to
12e6e0f
Compare
12e6e0f
to
318a4d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! 👍
Some nits:
Should we consider updating the indents when label is used together with helper text?
Due to the order
usage in styles, error-message is also changing the position with theme helper-above-field
. Is it intended?
Should the helper text be mentioned on the screen readers (not mentioned currently on Voice over).
test/text-field.html
Outdated
|
||
it('text-field with slotted helper updates has-helper attribute', function(done) { | ||
const textFieldSlottedHelper = fixture('default-with-slotted-helper'); | ||
setTimeout(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can avoid timeouts by using similar approach as in text-field
with dispatching slot-change
:
vaadin-text-field/test/custom-input.html
Line 79 in 2c9c8aa
function dispatchSlotChange() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, except it didn't work with this test:
vaadin-text-field/test/text-field.html
Lines 379 to 388 in 7cae1f2
it('removing slotted helper removes has-helper attribute', function(done) { | |
const textFieldSlottedHelper = fixture('default-with-slotted-helper'); | |
const helper = textFieldSlottedHelper.querySelector('[slot="helper"]'); | |
textFieldSlottedHelper.removeChild(helper); | |
// dispatchHelperSlotChange does not work with this test | |
setTimeout(() => { | |
expect(textFieldSlottedHelper.hasAttribute('has-helper')).to.be.false; | |
done(); | |
}, 1); | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm...for me the same approach works in that test also
Thanks Yuriy :) I fixed the error message position and also the label padding when the helper text is above (I agree it looks better): When I test the voice over, the helper text is read after the label, and then if there is an error message it will be read after that. There is however some weird behaviour which happens on my system. When the helper is a slot it seems to cause the page to reload sometimes if you have voice over enabled and focus on the element. |
7cae1f2
to
dfd5c7d
Compare
This reverts commit d719168. # Conflicts: # src/vaadin-text-field-mixin.html # theme/lumo/vaadin-text-field-styles.html
helper-text
part below text fieldhas-helper
attribute whenhelperText
property is sethas-helper
attribute when content placed inhelper
slotaria-describedby
has-error-message
attribute (used to hide helper in material theme when error message is set)