ionic-team / ionic-team/ionic-framework

bug: ion-item-sliding - sliding will not work in Svelte (and possibly others without VDOM)

Offen
#26,466 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
package: core type: bug
Vorherrschende Sprache
TypeScript
Sterne
52.7k
Forks
13.3k
Ø Merge
1 T. 15 Std.
Gemergte PRs (30 T.)
51

Beschreibung

### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

- [ ] v4.x
- [ ] v5.x
- [X] v6.x
- [ ] Nightly

### Current Behavior

Sliding the options in ion-item-sliding will not work in Svelte(Kit) framework and possibly others that do not use VDOM (assumption)

The part in the Stencil code that seeks ion-item through queryselector is triggered in the `connectedCallback` hook of the webcomponent. This seems to be too early to detect any ion-item that is (to be) rendered as a child. Because of this, `this.item` is always `null` which basically renders the sliding feature useless. Also open/close methods won't work.

After some conversation with an Ionic member on Discord - the suggestion is to have the logic in `connectedCallback` moved to the lifecycle hook `componentDidLoad`.

https://discordapp.com/channels/520266681499779082/1051562091393335316/1051613247989612725

### Expected Behavior

Ion Item Sliding to slide whenever it is used by the user and/or programmatically

### Steps to Reproduce

Spin a svelte ionic project

`npm create ionic-svelte-app@latest`

replace +page.svelte with:

```

import { onMount } from 'svelte';

let itemSlidingStart: HTMLIonItemSlidingElement;
const dragEvent = async (event) => {
console.log('EVEs', event);
// debugger;
const stuff = await itemSlidingStart.getOpenAmount();

console.log('EVE', event, stuff);

// itemSlidingStart.open('start').then((x) => {
// console.log('SSS', x);
// });

// console.log('FIND THE ELEMENT IN SVELTE CODE', itemSlidingStart.querySelector('ion-item'));
};

onMount(() => {
console.log('adsadsa', itemSlidingStart);
});


Mark Unread


Delete

ssss

```

### Code Reproduction URL

https://github.com/sean-perkins/ionic-svelte-item-sliding

### Ionic Info

Ionic core version 6.x

### Additional Information

_No response_

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.