fix(input, textarea, select): account for multiple start/end slot elements (#29172)
Issue number: Internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> We add margin on content in the start/end slots so they do not run up against either the visible text label of the text in the input. However, we did not account for when multiple elements are placed into the same slot. As a result, this margin is added more times than it needs to be. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Updated the selector so the margin is only applied to either the last or first element in the slot. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Test Steps: 1. Check out `feature-8.0` 2. Add multiple `ion-button` elements into either the start or end slot on an input (you can reuse the template in `src/components/input/test/slots` 3. Observe that margin is added to every `ion-button`. --------- Co-authored-by: ionitron <hi@ionicframework.com>
@ -556,12 +556,12 @@ button {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
::slotted([slot="start"]) {
|
||||
::slotted([slot="start"]:last-of-type) {
|
||||
margin-inline-end: $form-control-label-margin;
|
||||
margin-inline-start: 0;
|
||||
}
|
||||
|
||||
::slotted([slot="end"]) {
|
||||
::slotted([slot="end"]:first-of-type) {
|
||||
margin-inline-start: $form-control-label-margin;
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
|
||||
@ -8,9 +8,13 @@ configs().forEach(({ title, screenshot, config }) => {
|
||||
`
|
||||
<ion-select label-placement="start" fill="solid" placeholder="Select weight" label="Weight">
|
||||
<ion-icon slot="start" name="barbell" aria-hidden="true"></ion-icon>
|
||||
<ion-icon slot="start" name="heart" aria-hidden="true"></ion-icon>
|
||||
<ion-button slot="end" aria-label="Show/hide password">
|
||||
<ion-icon slot="icon-only" name="lock-closed" aria-hidden="true"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button slot="end">
|
||||
<ion-icon slot="icon-only" name="trash" aria-hidden="true"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-select>
|
||||
`,
|
||||
config
|
||||
@ -25,9 +29,13 @@ configs().forEach(({ title, screenshot, config }) => {
|
||||
`
|
||||
<ion-select label-placement="floating" fill="solid" placeholder="Select weight" label="Weight">
|
||||
<ion-icon slot="start" name="barbell" aria-hidden="true"></ion-icon>
|
||||
<ion-icon slot="start" name="heart" aria-hidden="true"></ion-icon>
|
||||
<ion-button slot="end" aria-label="Show/hide password">
|
||||
<ion-icon slot="icon-only" name="lock-closed" aria-hidden="true"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button slot="end">
|
||||
<ion-icon slot="icon-only" name="trash" aria-hidden="true"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-select>
|
||||
`,
|
||||
config
|
||||
|
||||
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 6.5 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 6.8 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 6.9 KiB |