-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: use calciteInternal prefix for internal events #4496
refactor: use calciteInternal prefix for internal events #4496
Conversation
…r-internal-events
…r-internal-events
…r-internal-events
…s, calciteTreeItemSelect
…r-internal-events
…r-internal-events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 💯
src/components/combobox/combobox.tsx
Outdated
@@ -257,13 +257,13 @@ export class Combobox implements LabelableComponent, FormComponent, InteractiveC | |||
* Fired when the combobox is opened | |||
* @internal | |||
*/ | |||
@Event() calciteComboboxOpen: EventEmitter; | |||
@Event() calciteInternalComboboxOpen: EventEmitter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These open/close ones might be useful for users at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we be removing @internal from Open/Close events then and making them public? Or did you mean specifically for combobox?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I concur with @driskull on this one too. Open/Close events should probably be publicly exposed. Especially since this is a top-level component that isn't emitting this event for another Calcite component to listen for. In that case, just removing the @internal
label on it and restoring the original event name should suffice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just questioning why these are internal. We may want to expose them at some point but we can do so later if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a follow-up issue for all top-level components to publicly expose Open/Close events, or does this need to be discussed for all components, including nested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of starting a pattern discussion on open/close events and if places that use them should expose them publicly if they aren't already. Let's create a discussion for this here: https://github.com/Esri/calcite-components/discussions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For context, these and others were made internal because it wasn't clear if they were meant to be public and there are a few that could be consolidated into a generic calcite<Event>
.
@Event() calciteInputFocus: EventEmitter; | ||
@Event() calciteInternalInputFocus: EventEmitter; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
@Event() calciteInputBlur: EventEmitter; | ||
@Event() calciteInternalInputBlur: EventEmitter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the inputblur. That native event should bubble up.
The open/close ones seem like they should be public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should shadowed <input>
element events bubble up when there are calciteInput*
event equivalents? Seems redundant to allow both, but this is probably why these were labeled @internal
in the first place because we were relying on the native events to bubble.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there can be equivalents because CustomEvents aren't the same as Keydown, Click, Blur, etc.
I think we should let the native events bubble out.
I don't like how we're passing the native events in some Custom events either. Seems kind of odd to do that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I'm trying to understand the distinction between the native events and the custom events. What are the custom "Input" and "Change" events really there for if the native ones are already bubbling out and usable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually trying to remember why these two events are actually labeled @internal.
I think I remember now. It is most likely for other Calcite components that consume Calcite Input in their shadow DOM for styling or other purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like how we're passing the native events in some Custom events either. Seems kind of odd to do that.
I guess if we chose to stop bubbling the native events, this would be the way to still expose them to listeners via the custom event.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, created a discussion for this here: https://github.com/Esri/calcite-components/discussions/4546
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there can be equivalents because CustomEvents aren't the same as Keydown, Click, Blur, etc.
Should we then ditch redundant custom events like calciteInputBlur
and calciteInputFocus
(and potentially many others) and just rely on native bubbled events?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…m timePickerChange event, as this no longer bubbles up
…r-internal-events
Just leaving a note, I think this change should have been called out in the breaking changes section of the release notes. I was using |
Those props were marked as internal and omitted from the doc for quite a while now, hence why we didn't mark them as breaking. On the other hand, I understand the need for these events and will look into this in upcoming sprints (see #4611 (comment)). |
Fair enough. I'm working on upgrading from beta.43 to beta.86. Not sure if the internal tag was there before, if so apologies. Thanks. |
Related Issue: #2256
Summary
Renaming internal events to use calciteInternal prefix and stopping them from propagating when handled (where propagation is not needed).
List of Internal Events revised:
calciteAccordionItemKeyEvent
calciteAccordionItemSelect
calciteAccordionItemClose
calciteItemRegister
calciteAlertSync
calciteAlertRegister
calciteComboboxOpen
calciteComboboxClose
calciteDayHover
calciteDatePickerHover
calciteDatePickerMouseOut
calciteDropdownItemChange
calciteDropdownItemSelect
calciteDropdownItemKeyEvent
calciteDropdownCloseRequest
calciteInlineEditableEnableEditingChange
stop and check if all green first
calciteInputFocus
calciteInputBlur
calciteInputDatePickerOpen
calciteInputDatePickerClose
calciteInternalLabelClick
calciteOptionChange
calciteOptionGroupChange
calciteListItemPropsChange
calciteListItemValueChange
calciteInternalRadioButtonBlur
calciteInternalRadioButtonCheckedChange
calciteInternalRadioButtonFocus
calciteRadioGroupItemChange
calciteStepperItemChange
calciteStepperItemKeyEvent
calciteStepperItemSelect
calciteStepperItemRegister
calciteTabRegister
calciteInternalTabChange
calciteInternalTabsActivate
calciteTabsFocusNext
calciteTabsFocusPrevious
calciteTabTitleRegister
calciteTabTitleRegister
calciteTimePickerBlur
calciteTimePickerChange
calciteTimePickerFocus
calciteTreeItemSelect