Skip to content

Commit

Permalink
TextArea: Placeholder is not removed when text is inserted into a fie…
Browse files Browse the repository at this point in the history
…ld and the current browser tab is duplicated (T1187078) (#26023)
  • Loading branch information
EugeniyKiyashko authored Nov 15, 2023
1 parent d54377a commit afae5df
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
7 changes: 1 addition & 6 deletions packages/devextreme/js/ui/text_area.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import TextBox from './text_box';
// STYLE textArea

const TEXTAREA_CLASS = 'dx-textarea';
const TEXTEDITOR_INPUT_CLASS = 'dx-texteditor-input';
const TEXTEDITOR_INPUT_CLASS_AUTO_RESIZE = 'dx-texteditor-input-auto-resize';

const TextArea = TextBox.inherit({
Expand Down Expand Up @@ -100,10 +99,7 @@ const TextArea = TextBox.inherit({
return $input;
},

_applyInputAttributes: function($input, customAttributes) {
$input.attr(customAttributes)
.addClass(TEXTEDITOR_INPUT_CLASS);
},
_setInputMinHeight: noop,

_renderScrollHandler: function() {
this._eventY = 0;
Expand Down Expand Up @@ -131,7 +127,6 @@ const TextArea = TextBox.inherit({
this._eventY = currentEventY;
},


_renderDimensions: function() {
const $element = this.$element();
const element = $element.get(0);
Expand Down
9 changes: 7 additions & 2 deletions packages/devextreme/js/ui/text_box/ui.text_editor.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,13 @@ const TextEditorBase = Editor.inherit({
const inputAttributes = extend(this._getDefaultAttributes(), customAttributes);
$input
.attr(inputAttributes)
.addClass(TEXTEDITOR_INPUT_CLASS)
.css('minHeight', this.option('height') ? '0' : '');
.addClass(TEXTEDITOR_INPUT_CLASS);

this._setInputMinHeight($input);
},

_setInputMinHeight: function($input) {
$input.css('minHeight', this.option('height') ? '0' : '');
},

_getPlaceholderAttr() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ QUnit.module('widget sizing render', () => {

assert.equal(elementStyles.maxHeight, '30px', 'widget max-height is correct');
});

QUnit.test('textarea with height option should not have min-height inline style', function(assert) {
const $element = $('#textarea').dxTextArea({
height: 50,
value: 'First'
});

const $input = $element.find(`.${INPUT_CLASS}`);

assert.strictEqual($input.get(0).style.minHeight, '', 'min-height inline style is not defined');
});
});

QUnit.module('aria accessibility', () => {
Expand Down

0 comments on commit afae5df

Please sign in to comment.