Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

refactor(list): simplify list component scss #9194

Merged
merged 1 commit into from
Jan 4, 2017

Conversation

devversion
Copy link
Member

  • Simplifies the List components SCSS
  • Fixes Dense Mode for List and introduces super elegant approach
  • Make SCSS more modular by having a base and dynamic variables
  • Remove unnecessary DOM node level for button wrap.
  • No longer wrap proxied elements inside of buttons
  • Multiple Secondary Items should align properly and have consistent spacing.
  • Dense Mode should not cut characaters on different environments.

@EladBezalel and I had a short meeting and I showed him some of the new approaches.

R: @EladBezalel

Fixes #6152. Fixes #8890 References #8482.

@@ -0,0 +1,300 @@
/** External component calculations */
$md-checkbox-width: 3 * $baseline-grid !default;
//TODO(devversion): use shared variable from buttons.scss
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's for future work please file an issue and write it's number on the comment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's an issue, which is not depending on that PR, it would make sense to create it.

See #9196

@EladBezalel
Copy link
Member

I really like the approach we should consider future work on dense components to behave the same.

Sort of related question:
Are we applying dense mode automatically on small screens?

@clshortfuse

@devversion
Copy link
Member Author

devversion commented Jul 31, 2016

@EladBezalel - Yeah as discussed in our talk. I'll create a follow-up PR, which makes the dense helpers more generic and usable for other components. I'll create an issue once this PR is available.

@devversion devversion force-pushed the refactor/list-component-scss branch 3 times, most recently from 9f48da1 to 1a49b9e Compare August 5, 2016 18:23
@@ -99,6 +99,8 @@ $md-list-item-subheader-height: 6 * $baseline-grid !default;
margin-top: $baseline-grid;
margin-bottom: $baseline-grid;
border-radius: 50%;

flex-shrink: 0; // Per https://bugs.webkit.org/show_bug.cgi?id=146020
Copy link
Member

@EladBezalel EladBezalel Aug 7, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like its resolved already

Status: RESOLVED FIXED

Copy link
Member Author

@devversion devversion Aug 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's resolved in the latest Webkit version, but it's not resolved in the latest Safari version (probably in the Technology Preview).

I tested that on my Mac Book and the bug is still valid.

@ThomasBurleson ThomasBurleson added this to the 1.2.0 milestone Aug 22, 2016
@topherfangio topherfangio added needs: manual testing This issue or PR needs to have some manual testing and verification done and removed needs: group review labels Sep 9, 2016
@topherfangio topherfangio self-assigned this Sep 9, 2016
@devversion devversion added the needs: rebase This PR needs to be rebased on the latest commits from master and conflicts need to be resolved label Sep 10, 2016
@devversion devversion removed the needs: rebase This PR needs to be rebased on the latest commits from master and conflicts need to be resolved label Sep 19, 2016
@devversion
Copy link
Member Author

@topherfangio Friendly ping for review if you find some time ;)

Copy link
Contributor

@topherfangio topherfangio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codewise looks pretty good. Found a few issues when running a visual diff (manual..no automation yet):

You can view my diff along with the comments at You can view comments at https://invis.io/2D8TWLO7S

  1. The avatars on the Basic Usage > Normal > 3 line item demo appear to be top-aligned instead of middle-aligned (Screens 1 & 2).
  2. In the same demo, the Dense mode "Classes" section looks better in this PR than in latest, so good work there 👍 (Screens 3 & 4)
  3. The List Controls demo is vastly different regarding spacing/padding (Screens 5 & 6). Is the PR aligned with the spec?

@@ -381,7 +380,8 @@ function mdListItemDirective($mdAria, $mdConstant, $mdUtil, $timeout) {
secondaryItem = buttonWrapper[0];
}

if (secondaryItem && (!hasClickEvent(secondaryItem) || (!tAttrs.ngClick && isProxiedElement(secondaryItem)))) {
if (secondaryItem && !tAttrs.ngClick && !hasClickEvent(secondaryItem)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you describe why this logic has changed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic was invalid, but not really often causing any issues.

We should not remove the md-secondary class when the element just doesn't have any ng-click on it (-> this means it will be marked as a proxied element)

  • Now it only targets the element for being a proxied element when all conditions are met .

See issue #6152

src/components/list/list.spec.js Show resolved Hide resolved
src/components/list/list.spec.js Show resolved Hide resolved

expect($rootScope.isChecked).toBeFalsy();

var clickListener = listItem[0].querySelector('div');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename this to something more descriptive about the actual container? listener immediately makes me think this is an event listener rather than a DOM element.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree with that. Just changed and also added a comment :)

@topherfangio topherfangio added needs: presubmit and removed needs: manual testing This issue or PR needs to have some manual testing and verification done needs: review This PR is waiting on review from the team labels Oct 5, 2016
@jelbourn
Copy link
Member

jelbourn commented Dec 2, 2016

@devversion can you rebase?

@googlebot googlebot added the cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ label Dec 3, 2016
* Simplifies the List components SCSS
* Fixes Dense Mode for List and introduces super elegant approach
* Make SCSS more modular by having a base and dynamic variables
* Remove unnecessary DOM node level for button wrap.
* No longer wrap proxied elements inside of buttons
* Multiple Secondary Items should align properly and have consistent spacing.
* Dense Mode should not cut characaters on different environments.

Fixes angular#6152. Fixes angular#8890 References angular#8482.
@devversion
Copy link
Member Author

@jelbourn Done.

@kara kara added pr: merge ready This PR is ready for a caretaker to review and removed needs: presubmit labels Jan 4, 2017
@kara kara merged commit 085c5fd into angular:master Jan 4, 2017
@devversion devversion deleted the refactor/list-component-scss branch January 4, 2017 17:21
devversion added a commit to devversion/material that referenced this pull request Jan 4, 2017
@ThomasBurleson ThomasBurleson modified the milestones: 1.1.3, 1.2.0 Jan 4, 2017
davidenochk pushed a commit to davidenochk/material that referenced this pull request Feb 3, 2017
@Splaktar Splaktar modified the milestones: 1.1.3, 1.1.2 Mar 1, 2018
@Splaktar Splaktar removed this from the 1.1.2 milestone Sep 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has signed Google's CLA: https://opensource.google.com/docs/cla/ pr: merge ready This PR is ready for a caretaker to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

list: dense list cuts off some letters like 'g' list: checkbox secondary action gives aria-label warning
8 participants