Skip to content

Commit

Permalink
ColorPicker: Limit alpha decimal places (#5883)
Browse files Browse the repository at this point in the history
* Limit decimal points displayed in ColorPicker.

* Change file.

* Revert multiplier change.

* Finish reversion.

* Switch to precision to fix screener test.

* Revert snapshots.
  • Loading branch information
JasonGore committed Aug 9, 2018
1 parent c3c818b commit cfcff98
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "office-ui-fabric-react",
"comment": "ColorPicker: Limit decimal points shown for alpha.",
"type": "patch"
}
],
"packageName": "office-ui-fabric-react",
"email": "jagore@microsoft.com"
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class ColorPickerBase extends BaseComponent<IColorPickerProps, IColorPick
<TextField
className={classNames.input}
onBlur={this._onRGBAChanged}
value={String(color.a)}
value={String(color.a ? color.a.toPrecision(3) : color.a)}
componentRef={this._aText}
spellCheck={false}
ariaLabel={this.props.alphaLabel}
Expand Down Expand Up @@ -181,7 +181,7 @@ export class ColorPickerBase extends BaseComponent<IColorPickerProps, IColorPick
r: Number(this._rText.current.value),
g: Number(this._gText.current.value),
b: Number(this._bText.current.value),
a: Number((this._aText && this._aText.current.value) || 100)
a: Number(this._aText.current.value || 100)
})
);
};
Expand Down

0 comments on commit cfcff98

Please sign in to comment.