Skip to content

Commit de3db72

Browse files
authored
refactor: set top tooltip position for field components (#4628)
1 parent 2b18ffd commit de3db72

10 files changed

Lines changed: 41 additions & 12 deletions

File tree

‎integration/tests/component-tooltip.test.js‎

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,29 +29,49 @@ import { mouseenter, mouseleave } from '@vaadin/tooltip/test/helpers.js';
2929
{ tagName: Button.is },
3030
{ tagName: Checkbox.is },
3131
{ tagName: CheckboxGroup.is },
32-
{ tagName: ComboBox.is, applyShouldNotShowCondition: (comboBox) => comboBox.click() },
32+
{
33+
tagName: ComboBox.is,
34+
position: 'top',
35+
applyShouldNotShowCondition: (comboBox) => comboBox.click(),
36+
},
3337
{
3438
tagName: CustomField.is,
3539
children: '<vaadin-combo-box></vaadin-combo-box>',
3640
applyShouldNotShowCondition: (field) => field.inputs[0].click(),
3741
},
38-
{ tagName: DatePicker.is, applyShouldNotShowCondition: (datePicker) => datePicker.click() },
39-
{ tagName: DateTimePicker.is, applyShouldNotShowCondition: (element) => element.querySelector('input').click() },
42+
{
43+
tagName: DatePicker.is,
44+
position: 'top',
45+
applyShouldNotShowCondition: (datePicker) => datePicker.click(),
46+
},
47+
{
48+
tagName: DateTimePicker.is,
49+
position: 'top',
50+
applyShouldNotShowCondition: (element) => element.querySelector('input').click(),
51+
},
4052
{ tagName: Details.is, targetSelector: '[part="summary"]', position: 'bottom-start' },
41-
{ tagName: EmailField.is },
53+
{ tagName: EmailField.is, position: 'top' },
4254
{ tagName: Icon.is },
43-
{ tagName: IntegerField.is },
55+
{ tagName: IntegerField.is, position: 'top' },
4456
{ tagName: ListBox.is },
4557
{ tagName: MessageInput.is },
46-
{ tagName: MultiSelectComboBox.is, applyShouldNotShowCondition: (comboBox) => comboBox.click() },
47-
{ tagName: NumberField.is },
48-
{ tagName: PasswordField.is },
58+
{
59+
tagName: MultiSelectComboBox.is,
60+
position: 'top',
61+
applyShouldNotShowCondition: (comboBox) => comboBox.click(),
62+
},
63+
{ tagName: NumberField.is, position: 'top' },
64+
{ tagName: PasswordField.is, position: 'top' },
4965
{ tagName: RadioGroup.is },
50-
{ tagName: Select.is },
66+
{ tagName: Select.is, position: 'top' },
5167
{ tagName: Tab.is },
52-
{ tagName: TextArea.is },
53-
{ tagName: TextField.is },
54-
{ tagName: TimePicker.is, applyShouldNotShowCondition: (timePicker) => timePicker.click() },
68+
{ tagName: TextArea.is, position: 'top' },
69+
{ tagName: TextField.is, position: 'top' },
70+
{
71+
tagName: TimePicker.is,
72+
position: 'top',
73+
applyShouldNotShowCondition: (timePicker) => timePicker.click(),
74+
},
5575
].forEach(({ tagName, targetSelector, position, applyShouldNotShowCondition, children = '' }) => {
5676
describe(`${tagName} with a slotted tooltip`, () => {
5777
let element, tooltip, tooltipOverlay;

‎packages/combo-box/src/vaadin-combo-box.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ class ComboBox extends ComboBoxDataProviderMixin(
251251

252252
this._tooltipController = new TooltipController(this);
253253
this.addController(this._tooltipController);
254+
this._tooltipController.setPosition('top');
254255
this._tooltipController.setShouldShow((target) => !target.opened);
255256

256257
this._positionTarget = this.shadowRoot.querySelector('[part="input-field"]');

‎packages/date-picker/src/vaadin-date-picker.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ class DatePicker extends DatePickerMixin(InputControlMixin(ThemableMixin(Element
214214

215215
this._tooltipController = new TooltipController(this);
216216
this.addController(this._tooltipController);
217+
this._tooltipController.setPosition('top');
217218
this._tooltipController.setShouldShow((target) => !target.opened);
218219

219220
const toggleButton = this.shadowRoot.querySelector('[part="toggle-button"]');

‎packages/date-time-picker/src/vaadin-date-time-picker.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ class DateTimePicker extends FieldMixin(
428428

429429
this._tooltipController = new TooltipController(this);
430430
this.addController(this._tooltipController);
431+
this._tooltipController.setPosition('top');
431432
this._tooltipController.setShouldShow((target) => {
432433
return target.__datePicker && !target.__datePicker.opened && target.__timePicker && !target.__timePicker.opened;
433434
});

‎packages/multi-select-combo-box/src/vaadin-multi-select-combo-box.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ class MultiSelectComboBox extends ResizeMixin(InputControlMixin(ThemableMixin(El
515515

516516
this._tooltipController = new TooltipController(this);
517517
this.addController(this._tooltipController);
518+
this._tooltipController.setPosition('top');
518519
this._tooltipController.setShouldShow((target) => !target.opened);
519520

520521
this._inputField = this.shadowRoot.querySelector('[part="input-field"]');

‎packages/number-field/src/vaadin-number-field.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ export class NumberField extends InputFieldMixin(ThemableMixin(ElementMixin(Poly
237237

238238
this._tooltipController = new TooltipController(this);
239239
this.addController(this._tooltipController);
240+
this._tooltipController.setPosition('top');
240241
}
241242

242243
/**

‎packages/select/src/vaadin-select.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ class Select extends DelegateFocusMixin(DelegateStateMixin(FieldMixin(ElementMix
376376
processTemplates(this);
377377

378378
this._tooltipController = new TooltipController(this);
379+
this._tooltipController.setPosition('top');
379380
this.addController(this._tooltipController);
380381
}
381382

‎packages/text-area/src/vaadin-text-area.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ export class TextArea extends ResizeMixin(PatternMixin(InputFieldMixin(ThemableM
228228
this.addController(new LabelledInputController(this.inputElement, this._labelController));
229229

230230
this._tooltipController = new TooltipController(this);
231+
this._tooltipController.setPosition('top');
231232
this.addController(this._tooltipController);
232233

233234
this.addEventListener('animationend', this._onAnimationEnd);

‎packages/text-field/src/vaadin-text-field.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ export class TextField extends PatternMixin(InputFieldMixin(ThemableMixin(Elemen
180180
this.addController(new LabelledInputController(this.inputElement, this._labelController));
181181

182182
this._tooltipController = new TooltipController(this);
183+
this._tooltipController.setPosition('top');
183184
this.addController(this._tooltipController);
184185
}
185186
}

‎packages/time-picker/src/vaadin-time-picker.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
358358

359359
this._tooltipController = new TooltipController(this);
360360
this._tooltipController.setShouldShow((timePicker) => !timePicker.opened);
361+
this._tooltipController.setPosition('top');
361362
this.addController(this._tooltipController);
362363
}
363364

0 commit comments

Comments
 (0)