Skip to content

[tooltip] Can't override pre-defined position for components that set it #4652

Closed

Description

@web-padawan

Description

When using setPosition() in TooltipController, it overrides the position property set on the vaadin-tooltip.
This forces the position (e.g. top in case of vaadin-text-field) and makes it impossible to override it.

Expected outcome

  1. There should be a property like _defaultPosition in vaadin-tooltip component (defaults to bottom),
  2. There should be a method like setDefaultPosition() in TooltipController to update this property,
  3. The default position property value should be removed in favor of using _defaultPosition value.

Minimal reproducible example

<script type="module">
  import '@vaadin/text-field';
  import '@vaadin/tooltip';

  const field = document.createElement('vaadin-text-field');

  const tooltip = document.createElement('vaadin-tooltip');
  tooltip.text = 'Tooltip text';
  tooltip.position = 'end';
  tooltip.setAttribute('slot', 'tooltip');
  field.appendChild(tooltip);

  document.body.appendChild(field);
</script>

Steps to reproduce

  1. Add the snippet above to the HTML page
  2. Show the tooltip with hover or focus

Environment

Vaadin version(s): 23.3.0-alpha2

Browsers

Issue is not browser related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions