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.

ion-item 'lines' attribute does nothing (docs incorrect?)

See original GitHub issue

Ionic version: (check one with “x”) (For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1) [ ] 2.x [ ] 3.x [x] 4.x

I’m submitting a … (check one with “x”) [x] bug report [ ] feature request

Current behavior:

Please see forum conversation here.

Your documentation is incorrect. The documentation states that the lines attribute must be placed on the ion-item component. However, that didn’t work. Instead, the lines attribute needs to be placed on the ion-list component.

Expected behavior:

Hide lines when lines attribute is supplied on the ion-item component.

Steps to reproduce:

Related code: Forum link.

insert short code snippets here

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

insert the output from ionic info here

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
brandyscarneycommented, Aug 15, 2018

It’s a bug because of the ion-menu-toggle wrapper. Because our CSS is targeting the item:last-child to apply a border on it, and it is wrapped in another element, it is always considered the last-child of that element so it is getting the border even with lines="none" applied to the item. This is something we need to fix.

With that said, it seems that the issue here is actually with the following rule being applied because of the ion-menu-toggle element wrapping the item:

.list-ios:not(.list-inset):not(.list-ios-lines-none) .item:last-child {
    --inner-border-width: 0;
    --border-width: 0 0 0.55px 0;
}
2reactions
a11smilescommented, Aug 15, 2018

@brandyscarney I’m not necessarily saying the documentation isn’t correct. As a matter of fact, the lab environment rendered correctly in Safari with the lines="none" on the ion-item element. However, the Ion DevApp still rendered the lines.

The only way for the Ion DevApp to hide the lines was me applying thelines attribute to the ion-list.

To refresh…

This did not work:

    <ion-list>
      <ion-menu-toggle *ngFor="let page of appPages">
        <ion-item lines="none" detail-none [routerLink]="page.url" [routerDirection]="'root'">
          <ion-icon slot="start" [name]="page.icon" color="primary"></ion-icon>
          <ion-label>{{page.title}}</ion-label>
        </ion-item>
      </ion-menu-toggle>
    </ion-list>

This did work:

<ion-app>
  <ion-split-pane>
    <ion-menu type="overlay">
      <ion-header>
        <ion-toolbar>
          <ion-title>
            Menu
          </ion-title>
        </ion-toolbar>
      </ion-header>
      
      <ion-content padding>
        <ion-list lines="none">
          <ion-menu-toggle *ngFor="let page of appPages">
            <ion-item detail="false" [routerLink]="page.url" [routerDirection]="'root'">
              <ion-icon slot="start" [name]="page.icon" color="primary"></ion-icon>
              <ion-label>{{page.title}}</ion-label>
            </ion-item>
          </ion-menu-toggle>
        </ion-list>
      </ion-content>
    </ion-menu>
    <ion-router-outlet main></ion-router-outlet>
  </ion-split-pane>
</ion-app>

Perhaps, it’s a bug in the Ion DevApp? Or, as you suggested, a CSS issue?

Thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ion-item - Ionic Framework
An item is considered "clickable" if it has an href or button property set. Clickable items have a few visual differences that indicate...
Read more >
ion-item - Ionic Documentation
An item is considered "clickable" if it has an href or button property set. Clickable items have a few visual differences that indicate...
Read more >
Ion-item attributes in Beta 4
EDIT 2: I was looking at the GitHub Docs that noted there was a lines attribute with three possible values: full (default), inset...
Read more >
ion-input: Custom Input Value Type Styling and CSS Properties
The error slot will not be displayed unless the ion-invalid class is added to the ion-item . In Angular, this is done automatically...
Read more >
ion-item-options - Ionic Framework
The ionSwipe event and the expandable property can be combined to create a ... See the item sliding documentation for more information. ......
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