Merged
Conversation
|
|
| const labelSlot = el.querySelector('[slot="label"]'); | ||
|
|
||
| if (labelSlot !== null) { | ||
| return labelSlot.textContent; |
Contributor
There was a problem hiding this comment.
Passing this as-is to the alert header gives odd results when using a more complicated label structure. For example, opening this:
<ion-select placeholder="Select">
<div slot="label">
<div>Select a Fruit</div>
<ion-note>This will be remembered.</ion-note>
</div>
<ion-select-option value="apple">Apple</ion-select-option>
</ion-select>Leads to this:
While I can't think of a good way to have Ionic solve this automatically, I noticed you can overwrite it manually using interfaceOptions, and that still works:
<ion-select placeholder="Select" id="weird-label">
<div slot="label">
<div>Select a Fruit</div>
<ion-note>This will be remembered.</ion-note>
</div>
<ion-select-option value="apple">Apple</ion-select-option>
</ion-select>
<script>
const select = document.querySelector('#weird-label');
select.interfaceOptions = {
header: 'Select a Fruit'
};
</script>Maybe we'll just want to document this pattern and leave it as-is?
Contributor
Author
There was a problem hiding this comment.
Yep, I can make sure this is documented.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Issue number: N/A
What is the current behavior?
ion-selecthas no way to accept a custom HTML labelWhat is the new behavior?
labelslot toion-selecttextContentof the label slot (if provided) to be the default header onion-alert. This matches the behavior of passing thelabelprop contents to be the default header onion-alert.Note: This PR does not account for the notch rendering with
fill="outline"that will be handled in a separate PR.Does this introduce a breaking change?
Other information