Repository navigation
Conversation
…eEnd event details
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
brandyscarney
left a comment
There was a problem hiding this comment.
Nice work! I checked confirmed all of the new events are emitting properly and the bug fix for scrollY. I added two small requests but I am approving as they are not blockers!
| const { contentEl } = this; | ||
|
|
||
| if (contentEl) { | ||
| this.initialContentScrollY = disableContentScrollY(contentEl); |
There was a problem hiding this comment.
Since this resolves #30952, could we add a regression test for it? Something like rendering <ion-content scroll-y="false"> with an ion-range inside, tapping the bar, and checking that content.scrollY is still false, with an issue annotation linking #30952.
To reproduce: open the before and after pages and paste this into the console:
const content = document.querySelector('ion-content');
content.scrollY = false;
content.innerHTML = `<ion-range aria-label="Range" value="20"></ion-range>`;Tap anywhere on the range bar, then run content.scrollY. Before, it returns true. After, it stays false.
| * | ||
| * For example: When the user lifts their finger from the | ||
| * screen after tapping the bar or dragging the bar or knob. | ||
| * @param startX The x coordinate where the interaction started. |
There was a problem hiding this comment.
The gesture resets startX to currentX right before onStart fires. So this is where the pointer was once it passed the 10px threshold, not where the user pressed. That matches what the old onMove used, so the behavior is fine, but the comment could say that:
| * @param startX The x coordinate where the interaction started. | |
| * @param startX The x coordinate when the drag started. |
Issue number: resolves #25216
What is the current behavior?
Currently,
ionKnobMoveStartandionKnobMoveEndonly includevalue, so a range withdualKnobshas no way to tell you which knob the user moved.What is the new behavior?
Both events now include
knobandpositionin their detail. Theknobfield is'A'or'B'and stays the same if the knobs cross. Thepositionfield is'lower'or'upper', based on the value that knob holds before the move on start and after it on end, so dragging knob A past knob B reportslowerand thenupper. A single knob range always reports'A'and'lower'.To report the knob on
ionKnobMoveStart, we now pick it inonStart. Before this, it was picked on the firstonMove, after the start event had already fired.Does this introduce a breaking change?
Other information
The field names match range's existing shadow parts, where
knob-aandknob-bstick with a knob andknob-lowerandknob-upperswap when the knobs cross. We expose both because the issue asks for different behavior per knob, and some apps will care about the knob while others care about which value it changed.The new types use the
Rangeprefix like the other range types (RangeValue,RangeCustomEvent). There's aRangeKnobNameandRangeKnobPositionfor the field values, plus aRangeKnobMoveStartCustomEventandRangeKnobMoveEndCustomEventper event, the same way we addedReorderMoveCustomEventandRefresherPullEndCustomEvent. The custom event types are exported from core and from the Angular, React and Vue packages.We export them because otherwise
RangeCustomEventis the only typed option, and itsdetailis a union that includesRangeChangeEventDetail, so readingknobneeds a cast:Tapping a range inside an
ion-contentwithscroll-y="false"also no longer turns scrolling back on, since the tap now saves the scroll state before restoring it. This was sort of an unexpected bug fix that came along for the ride (resolves #30952)Docs PR
ionic-team/ionic-docs#4849