Skip to content

Commit

Permalink
fix: do not focus the field on helper element click
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarezguille committed Jul 21, 2021
1 parent 24e8c66 commit 640c7ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vaadin-custom-field.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<div class="inputs-wrapper" on-change="__updateValue">
<slot id="slot"></slot>
</div>
<div part="helper-text" on-click="focus" id="[[__helperTextId]]">
<div part="helper-text" id="[[__helperTextId]]">
<slot name="helper" id="helperSlot">[[helperText]]</slot>
</div>
<div part="error-message"
Expand Down
10 changes: 10 additions & 0 deletions test/custom-field-basic-test.html
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,16 @@

expect(customFieldWithSlottedHelper.hasAttribute('has-helper')).to.be.false;
});

it('should not get focus after helper click', function() {
const field = fixture('default-with-slotted-helper');
const helper = field.querySelector('[slot="helper"]');
const spy = sinon.spy(field, 'focus');

helper.click();

expect(spy.called).to.be.false;
});
});

describe('aria-desribedby', function() {
Expand Down

0 comments on commit 640c7ce

Please sign in to comment.