Skip to content
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

Prerender removes [contentId] and breaks ion-menu #2119

Closed
tricki opened this issue Jan 8, 2020 · 1 comment · Fixed by ionic-team/ionic-framework#20169
Closed

Prerender removes [contentId] and breaks ion-menu #2119

tricki opened this issue Jan 8, 2020 · 1 comment · Fixed by ionic-team/ionic-framework#20169
Labels

Comments

@tricki
Copy link
Contributor

tricki commented Jan 8, 2020

Stencil version:

 @stencil/core@1.8.2

I'm submitting a:

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior:
Prerender removes the ion-menu[contentId] attribute and causes a console warning and an error:

WARN: [DEPRECATED][ion-menu] Using the [main] attribute is deprecated, please use the "contentId" property instead:
BEFORE:
  <ion-menu>...</ion-menu>
  <div main>...</div>

AFTER:
  <ion-menu contentId="my-content"></ion-menu>
  <div id="my-content">...</div>

ERROR: Menu: must have a "content" element to listen for drag events on.

Expected behavior:
No warnings / errors.

Steps to reproduce:

  1. Create a new Stencil project with the ionic-pwa starter.
  2. Add <ion-menu contentId="main-content">.
  3. Add an <ion-content contentId="main-content">.
  4. Run npm run build --prerender and launch in the browser.

Related code:

import { Component, h } from '@stencil/core';

@Component({
  tag: 'app-root',
})
export class AppRoot {

  render() {
    return (
      <ion-app>
        <ion-menu contentId="main-content">
          <ion-header>
            <ion-toolbar>
              <ion-title>Menu</ion-title>
            </ion-toolbar>
          </ion-header>
        </ion-menu>
        <ion-content id="main-content">
          <h1>Hello</h1>
        </ion-content>
        <ion-nav />
      </ion-app>
    );
  }
}

Other information:
The same problem exists with <ion-split-pane> (split pane does not have a specified main node).

Workaround:
Add an additional content-id attribute to <ion-menu> with the same value as contentId.

@ionitron-bot ionitron-bot bot added the triage label Jan 8, 2020
@adamdbradley
Copy link
Contributor

adamdbradley commented Jan 8, 2020

We'll fix this in ionic by adding reflect to the props. But for now you can still set just the attribute content-id. Hope that helps, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants