Keyboard not displayed II

This issue has been tracked since 2022-03-02.

Hi Francisco,
It's sad that you lock the issue below while I'm still investigating it, 2 hours after I got an answer from OP.
I found what was the issue, it's not in your repo, but I guess I can provide some input if someone had the same issue but I can't in the old one as the issue is locked.

In my case the issue was a side-effect of Ionic:
Ionic sometimes caches angular components and therefore don't call standard Angular lifecycle hooks (such as OnInit, AfterViewInit, OnDestroy) even when a new page is displayed.
Therefore, in my case, the component that holds the keyboard was being re-used and those functions were never called:

 ngAfterViewInit() {
        this.keyboard = new Keyboard({...});
        ...
  }
  ngOnDestroy(): void {
        this.keyboard?.destroy();
    }

That's why simple-keyboard was not displayed the second time.

Best regards,
Daniel


Sadly I did not get the repro so I cannot tell for sure what the issue is. That being said, you can try giving different classes to each keyboard:

https://hodgef.com/simple-keyboard/questions-answers/give-different-base-class-keyboard/

Alternatively, you can try calling destroy on route unload:
https://hodgef.com/simple-keyboard/documentation/methods/destroy/

Hope that helps. Closing the thread as I cannot do much here without repro.

Regards,
Francisco Hodge

Originally posted by @hodgef in #1446 (comment)

hodgef wrote this answer on 2022-03-02

Thanks for sharing the solution Daniel! I locked the issue #1446 because I thought the conversation could end up in a back and forth with no repro provided. I really appreciate that you took the time to share your findings with everyone.

Regards,
Francisco Hodge

More Details About Repo
Owner Name hodgef
Repo Name simple-keyboard
Full Name hodgef/simple-keyboard
Language JavaScript
Created Date 2018-03-02
Updated Date 2022-12-06
Star Count 1738
Watcher Count 20
Fork Count 130
Issue Count 0

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date