UI: Fix a couple of issues with material button * Use the text/elevated css var to set height instead of setting heigh via `height:` * Fix click surface by setting touch-target to none. This makes it so the touch target does not go outside the visible button. * Fix the font by putting `font: inherit` in md-text/elevated-button rather than in :host. Release-Notes: skip Change-Id: I2c3d6978650efd9744492750e29d1c675fc16322 Signed-off-by: Paladox none <thomasmulhall410@yahoo.com>
diff --git a/polygerrit-ui/app/elements/shared/gr-button/gr-button.ts b/polygerrit-ui/app/elements/shared/gr-button/gr-button.ts index e01fdf4..febce7e 100644 --- a/polygerrit-ui/app/elements/shared/gr-button/gr-button.ts +++ b/polygerrit-ui/app/elements/shared/gr-button/gr-button.ts
@@ -91,7 +91,6 @@ /* This is also set in the button-label-(font|weight) css vars above. We keep this incase it is also needed. */ font-weight: var(--font-weight-medium); font-family: var(--header-font-family); - font: inherit; color: var(--text-color); --md-text-button-container-color: var(--text-color); } @@ -128,6 +127,8 @@ align-items: center; background-color: var(--background-color); color: var(--text-color); + /* paper-button set this but md-(elevated|text)-button does not. So we set it. */ + font: inherit; /* This is also set in the button-label-(font|weight) css vars above. We keep this incase it is also needed. */ font-family: var(--font-family, inherit); font-weight: var(--font-weight-normal, inherit); @@ -137,8 +138,8 @@ min-width: var(--border, 0); padding: var(--gr-button-padding, var(--spacing-s) var(--spacing-m)); /* Needed to resize properly */ - min-height: auto; - height: auto; + --md-elevated-button-container-height: none; + --md-text-button-container-height: none; cursor: pointer; } :host md-text-button:hover, @@ -208,6 +209,7 @@ class=${buttonClass} ?disabled=${this.disabled || this.loading} part="md-elevated-button" + touch-target="none" role="button" tabindex="-1" > @@ -223,6 +225,7 @@ class=${buttonClass} ?disabled=${this.disabled || this.loading} part="md-text-button" + touch-target="none" role="button" tabindex="-1" >
diff --git a/polygerrit-ui/app/elements/shared/gr-button/gr-button_test.ts b/polygerrit-ui/app/elements/shared/gr-button/gr-button_test.ts index 491fd3a..a80d8d5 100644 --- a/polygerrit-ui/app/elements/shared/gr-button/gr-button_test.ts +++ b/polygerrit-ui/app/elements/shared/gr-button/gr-button_test.ts
@@ -39,6 +39,7 @@ data-role="button" part="md-elevated-button" tabindex="-1" + touch-target="none" value="" ><slot></slot> </md-elevated-button>
diff --git a/polygerrit-ui/app/embed/diff/gr-diff-image-viewer/gr-image-viewer.ts b/polygerrit-ui/app/embed/diff/gr-diff-image-viewer/gr-image-viewer.ts index f352689..67a4277 100644 --- a/polygerrit-ui/app/embed/diff/gr-diff-image-viewer/gr-image-viewer.ts +++ b/polygerrit-ui/app/embed/diff/gr-diff-image-viewer/gr-image-viewer.ts
@@ -457,6 +457,7 @@ <div id="version-switcher"> <md-text-button class=${classMap(leftClasses)} + touch-target="none" @click=${this.selectBase} > Base @@ -472,6 +473,7 @@ </paper-fab> <md-text-button class=${classMap(rightClasses)} + touch-target="none" @click=${this.selectRevision} > Revision