question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: IonToggle & IonRange issue in IonMenu

See original GitHub issue

Bug Report

Ionic version:

[ ] 4.x [x] 5.x

Current behavior:

IonToggle and IonRange are not interactable in an IonMenu. I’ve tested this via ionic serve with various browsers.

Expected behavior:

that those controls are interactable

Steps to reproduce:

putting those components in an IonMenu

Related code:

import React, { MutableRefObject, useEffect, useRef } from 'react';
import { IonContent, IonHeader, IonIcon, IonItem, IonLabel, IonList, IonMenu, IonNote, IonPage, IonRange, IonTitle, IonToggle, IonToolbar } from '@ionic/react';
import { glassesOutline, settingsOutline } from 'ionicons/icons';
import './Home.css';

const MyMenu = React.forwardRef<HTMLIonMenuElement, {}>((props, ref) => {

  return (
    <IonMenu ref={ref} contentId="menu-content" side="end" type="overlay" >
      <IonHeader>
        <IonToolbar color="primary">
          <IonIcon icon={settingsOutline} slot="secondary" />
          <IonTitle class="ion-text-capitalize">Menu</IonTitle>
        </IonToolbar>
      </IonHeader>
      <IonContent id="menu-content">
        <IonList>
          <IonItem>
            <IonLabel class="ion-text-capitalize">foo</IonLabel>
            <IonToggle color="success" slot="end" checked={true}  />
          </IonItem>
          <IonItem>
            <IonRange min={0} max={100} value={50}>
              <IonIcon icon={ glassesOutline } size="small" slot="start" />
              <IonIcon icon={ glassesOutline } size="medium" slot="end" />
            </IonRange>
          </IonItem>
          <IonItem>
           <IonButton>but I'm working</IonButton>
          </IonItem>
        </IonList>
      </IonContent>
  </IonMenu>
)})


const Home: React.FC = () => {

  const menuRef: MutableRefObject<HTMLIonMenuElement|null> = useRef(null)

  useEffect(() => {setTimeout(() => menuRef.current!!.setOpen(true), 1000)})

  return (
    <IonPage>
      <MyMenu ref={menuRef}/>
      <IonHeader>
        <IonToolbar>
          <IonTitle>Buggy</IonTitle>
        </IonToolbar>
      </IonHeader>
      <IonContent fullscreen onClick={async () => {
        const m = menuRef.current!!
        if(! await m.isOpen()) m.setOpen(true)
      }}>
        <IonNote class="ion-text-center">tap to open menu</IonNote>
      </IonContent>
    </IonPage>
  );
};

export default Home;

Other information:

Ionic info:

Ionic:

   Ionic CLI       : 6.12.3 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework : @ionic/react 5.5.4

Capacitor:

   Capacitor CLI   : 2.4.6
   @capacitor/core : 2.4.6

Utility:

   cordova-res (update available: 0.15.3) : 0.14.0
   native-run (update available: 1.3.0)   : 0.3.0

System:

   NodeJS : v12.16.1 (/usr/local/bin/node)
   npm    : 6.14.8
   OS     : macOS Catalina

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
liamdebeasicommented, Mar 3, 2021

Yeah that’s a really vague description 😅 . I will update the docs so it’s more clear.

0reactions
ionitron-bot[bot]commented, Apr 2, 2021

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: Two ion-menu in different tabs unable to working ...
I have searched for existing issues that already report this problem, without success. Ionic Framework Version. v4.x; v5.x
Read more >
ion-menu-toggle - Ionic Framework
The MenuToggle component can be used to toggle a menu open or closed—by default, it's only visible when the selected menu is active....
Read more >
A Knob Trick For Ion-Toggle and Ion-Range - Level Up Coding
One issue that I faced using the new framework versions recently was with the ion-range and ion-toggle components: Ionic 4+ and newer ...
Read more >
Ionic Range dual Knobs not showing - Stack Overflow
The problem is, the ion range is only showing one knob. ... This looks like a bug, could you create a new issue...
Read more >
(PDF) Build Mobile Apps with Ionic 4 and Firebase Hybrid ...
It is a common problem in many parts of Bangladesh that unregistered doctors ... So developers can find out this error immediately and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found