Content
View differences
Updated by Eric Schubert 7 months ago
### Problem
* If a page header contains action buttons, added with `.with_action_button`, those buttons get rendered twice.
* once in the `titleBar` and once in the `contextBar`
* both buttons share the same ID
* buttons in `contextBar` are hidden by default, unless on mobile resolutions, when they replace the buttons in the `titleBar`
* When turbo stream update responses are processed, while the DOM contains elements with duplicate IDs, the console spits out a warning, regardless of the fact if the ID is updated or not
* (potential) any update to the button itself would cause trouble, if the developer not takes into account of the effect that it is twice in the DOM
### Possible solution
* explicitly set two different IDs on those button elements
* e.g. `page-header-action-UUIDv4` for the `titleBar` and `page-header-mobile-action-UUIDv4` for the `contextBar`
* If the ID is overridden with system arguements - e.g. to really DO turbo stream updates - a warning/error is raised, if the mobile id system arguement is not handled at the same time
* this forces the developer to take both resolutions into account and think about a reasonable behaviour
* If a page header contains action buttons, added with `.with_action_button`, those buttons get rendered twice.
* once in the `titleBar` and once in the `contextBar`
* both buttons share the same ID
* buttons in `contextBar` are hidden by default, unless on mobile resolutions, when they replace the buttons in the `titleBar`
* When turbo stream update responses are processed, while the DOM contains elements with duplicate IDs, the console spits out a warning, regardless of the fact if the ID is updated or not
* (potential) any update to the button itself would cause trouble, if the developer not takes into account of the effect that it is twice in the DOM
### Possible solution
* explicitly set two different IDs on those button elements
* e.g. `page-header-action-UUIDv4` for the `titleBar` and `page-header-mobile-action-UUIDv4` for the `contextBar`
* If the ID is overridden with system arguements - e.g. to really DO turbo stream updates - a warning/error is raised, if the mobile id system arguement is not handled at the same time
* this forces the developer to take both resolutions into account and think about a reasonable behaviour