@vaadin/text-area 22.0.3 → 22.0.6

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.6",
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.6",
36
+ "@vaadin/field-base": "^22.0.6",
37
+ "@vaadin/input-container": "^22.0.6",
38
+ "@vaadin/vaadin-lumo-styles": "^22.0.6",
39
+ "@vaadin/vaadin-material-styles": "^22.0.6",
40
+ "@vaadin/vaadin-themable-mixin": "^22.0.6"
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": "18c55872d764e338e0f98e65826cbe895156251a"
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,22 @@ 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
+ const scrollTopBefore = this._inputField.scrollTop;
205
+ this._inputField.scrollTop += e.deltaY;
206
+
207
+ if (scrollTopBefore !== this._inputField.scrollTop) {
208
+ e.preventDefault();
209
+ this.__scrollPositionUpdated();
210
+ }
211
+ });
212
+
198
213
  this._updateHeight();
214
+ this.__scrollPositionUpdated();
199
215
  }
200
216
 
201
217
  /** @protected */
@@ -214,6 +230,12 @@ export class TextArea extends InputFieldMixin(ThemableMixin(ElementMixin(Polymer
214
230
  this.addEventListener('animationend', this._onAnimationEnd);
215
231
  }
216
232
 
233
+ /** @private */
234
+ __scrollPositionUpdated() {
235
+ this._inputField.style.setProperty('--_text-area-vertical-scroll-position', '0px');
236
+ this._inputField.style.setProperty('--_text-area-vertical-scroll-position', this._inputField.scrollTop + 'px');
237
+ }
238
+
217
239
  /** @private */
218
240
  _onAnimationEnd(e) {
219
241
  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' });