web-components icon indicating copy to clipboard operation
web-components copied to clipboard

fix: observe tabs ID attribute changes and update panels

Open web-padawan opened this issue 5 months ago • 1 comments

Description

Fixes https://github.com/vaadin/flow-components/issues/6072

Here's the code example to reproduce the issue and test the fix:

<vaadin-tabsheet>
  <vaadin-tabs slot="tabs">
    <vaadin-tab>Tab 1</vaadin-tab>
    <vaadin-tab>Tab 2</vaadin-tab>
  </vaadin-tabs>

  <div tab="tab-1">Panel 1</div>
  <div tab="tab-2">Panel 2</div>
</vaadin-tabsheet>

Put this to dev page and try to set id on the first vaadin-tab to tab-1.

Type of change

  • Bugfix

Note

Initially, I was thinking about adding a warning for vaadin-tab elements without id attribute set. However, Flow does not set id attribute when using setVisible(false) and it's by design, so in this case the warning would be redundant.

This fix can be also considered as "feature", as it also adds an option to un-link tab with panel by setting id to null.

web-padawan avatar Mar 13 '24 12:03 web-padawan

Hi @web-padawan and @web-padawan, when i performed cherry-pick to this commit to 24.3, i have encountered the following issue. Can you take a look and pick it manually? Error Message: Error: Command failed: git cherry-pick 8b975e7a89da64d5404509ca523c55947c7a7327 error: could not apply 8b975e7a8... fix: observe tabs ID attribute changes and update panels (#7201) hint: After resolving the conflicts, mark them with hint: "git add/rm ", then run hint: "git cherry-pick --continue". hint: You can instead skip this commit with "git cherry-pick --skip". hint: To abort and get back to the state before "git cherry-pick", hint: run "git cherry-pick --abort".

vaadin-bot avatar Mar 18 '24 11:03 vaadin-bot

This ticket/PR has been released with Vaadin 24.4.0.alpha17 and is also targeting the upcoming stable 24.4.0 version.

vaadin-bot avatar Mar 25 '24 16:03 vaadin-bot