Skip to content

Commit

Permalink
UI: Masked inputs always look the same when value is hidden (#15025) (#…
Browse files Browse the repository at this point in the history
…15034)

* Masked inputs always look the same when value is hidden

* Add changelog

* Fix failing test
  • Loading branch information
hashishaw authored Apr 14, 2022
1 parent 7caca87 commit 7df4156
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 81 deletions.
3 changes: 3 additions & 0 deletions changelog/15025.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: masked values no longer give away length or location of special characters
```
12 changes: 8 additions & 4 deletions ui/lib/core/addon/templates/components/masked-input.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
<div class="masked-input {{if displayOnly "display-only"}} {{if allowCopy "allow-copy"}}"
data-test-masked-input data-test-field>
{{#if displayOnly}}
<pre class="masked-value display-only is-word-break {{unless showValue "masked-font"}}">{{unless showValue (truncate value 20) value}}</pre>
{{#if showValue}}
<pre class="masked-value display-only is-word-break">{{value}}</pre>
{{else}}
<pre class="masked-value display-only masked-font">***********</pre>
{{/if}}
{{else if inputField}}
<input
autocomplete="off"
Expand All @@ -13,7 +17,7 @@
data-test-input
/>
{{else}}
<textarea
<textarea
class="input masked-value {{unless showValue "masked-font"}}"
rows=1 wrap="off"
onkeydown={{action onKeyDown}}
Expand All @@ -23,7 +27,7 @@
value="target.value"
}}
value={{value}}
data-test-textarea
data-test-textarea
/>
{{/if}}
{{#if allowCopy}}
Expand All @@ -35,7 +39,7 @@
<Icon @glyph="copy-action" aria-hidden="Copy value" />
</CopyButton>
{{/if}}
<button
<button
onclick={{action "toggleMask"}}
type="button"
class="{{if (eq value "") "has-text-grey"}} masked-input-toggle button"
Expand Down
Loading

0 comments on commit 7df4156

Please sign in to comment.