@vaadin/text-area 22.0.3 → 22.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/text-area",
3
- "version": "22.0.3",
3
+ "version": "22.0.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,17 +32,17 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@polymer/polymer": "^3.0.0",
35
- "@vaadin/component-base": "^22.0.3",
36
- "@vaadin/field-base": "^22.0.3",
37
- "@vaadin/input-container": "^22.0.3",
38
- "@vaadin/vaadin-lumo-styles": "^22.0.3",
39
- "@vaadin/vaadin-material-styles": "^22.0.3",
40
- "@vaadin/vaadin-themable-mixin": "^22.0.3"
35
+ "@vaadin/component-base": "^22.0.4",
36
+ "@vaadin/field-base": "^22.0.4",
37
+ "@vaadin/input-container": "^22.0.4",
38
+ "@vaadin/vaadin-lumo-styles": "^22.0.4",
39
+ "@vaadin/vaadin-material-styles": "^22.0.4",
40
+ "@vaadin/vaadin-themable-mixin": "^22.0.4"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@esm-bundle/chai": "^4.3.4",
44
44
  "@vaadin/testing-helpers": "^0.3.2",
45
45
  "sinon": "^9.2.1"
46
46
  },
47
- "gitHead": "935ad1ea65a79b0f9ecb10d767689479b36c4e07"
47
+ "gitHead": "55891f68d4da41e846e06dfe51dceba1665e41ce"
48
48
  }
@@ -138,11 +138,12 @@ export class TextArea extends InputFieldMixin(ThemableMixin(ElementMixin(Polymer
138
138
  disabled="[[disabled]]"
139
139
  invalid="[[invalid]]"
140
140
  theme$="[[theme]]"
141
+ on-scroll="__scrollPositionUpdated"
141
142
  >
142
143
  <slot name="prefix" slot="prefix"></slot>
143
144
  <slot name="textarea"></slot>
144
145
  <slot name="suffix" slot="suffix"></slot>
145
- <div id="clearButton" part="clear-button" slot="suffix"></div>
146
+ <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
146
147
  </vaadin-input-container>
147
148
 
148
149
  <div part="helper-text">
@@ -195,7 +196,18 @@ export class TextArea extends InputFieldMixin(ThemableMixin(ElementMixin(Polymer
195
196
  super.connectedCallback();
196
197
 
197
198
  this._inputField = this.shadowRoot.querySelector('[part=input-field]');
199
+
200
+ // Wheel scrolling results in async scroll events. Preventing the wheel
201
+ // event, scrolling manually and then synchronously updating the scroll position CSS variable
202
+ // allows us to avoid some jumpy behavior that would occur on wheel otherwise.
203
+ this._inputField.addEventListener('wheel', (e) => {
204
+ e.preventDefault();
205
+ this._inputField.scrollTop += e.deltaY;
206
+ this.__scrollPositionUpdated();
207
+ });
208
+
198
209
  this._updateHeight();
210
+ this.__scrollPositionUpdated();
199
211
  }
200
212
 
201
213
  /** @protected */
@@ -214,6 +226,12 @@ export class TextArea extends InputFieldMixin(ThemableMixin(ElementMixin(Polymer
214
226
  this.addEventListener('animationend', this._onAnimationEnd);
215
227
  }
216
228
 
229
+ /** @private */
230
+ __scrollPositionUpdated() {
231
+ this._inputField.style.setProperty('--_text-area-vertical-scroll-position', '0px');
232
+ this._inputField.style.setProperty('--_text-area-vertical-scroll-position', this._inputField.scrollTop + 'px');
233
+ }
234
+
217
235
  /** @private */
218
236
  _onAnimationEnd(e) {
219
237
  if (e.animationName.indexOf('vaadin-text-area-appear') === 0) {
@@ -21,6 +21,11 @@ const textArea = css`
21
21
  white-space: pre-wrap; /* override "nowrap" from <vaadin-text-field> */
22
22
  align-self: stretch; /* override "baseline" from <vaadin-text-field> */
23
23
  }
24
+
25
+ [part='input-field']::before,
26
+ [part='input-field']::after {
27
+ bottom: calc(var(--_text-area-vertical-scroll-position) * -1);
28
+ }
24
29
  `;
25
30
 
26
31
  registerStyles('vaadin-text-area', [inputFieldShared, textArea], { moduleId: 'material-text-area' });