Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 3fc1004

Browse files
crisbetohansl
authored andcommitted
fix(textarea): resize handle position occasionally wrong (#9155)
* Fixes the textarea's resize handle being in the wrong position if the `md-input-container` is taller than the textarea. * Moves the icon placement logic to the compile function, in order to be called less and to run before any other DOM manipulation logic. * Removes some unnecessary SASS nesting. Fixes #9151.
1 parent b26c01c commit 3fc1004

File tree

2 files changed

+27
-19
lines changed

2 files changed

+27
-19
lines changed

src/components/input/input.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,21 @@ function mdInputContainerDirective($mdTheming, $parse) {
9090

9191
return {
9292
restrict: 'E',
93-
link: postLink,
93+
compile: compile,
9494
controller: ContainerCtrl
9595
};
9696

97-
function postLink(scope, element) {
98-
$mdTheming(element);
99-
97+
function compile(tElement) {
10098
// Check for both a left & right icon
101-
var leftIcon = element[0].querySelector(LEFT_SELECTORS);
102-
var rightIcon = element[0].querySelector(RIGHT_SELECTORS);
99+
var leftIcon = tElement[0].querySelector(LEFT_SELECTORS);
100+
var rightIcon = tElement[0].querySelector(RIGHT_SELECTORS);
103101

104-
if (leftIcon) { element.addClass('md-icon-left'); }
105-
if (rightIcon) { element.addClass('md-icon-right'); }
102+
if (leftIcon) { tElement.addClass('md-icon-left'); }
103+
if (rightIcon) { tElement.addClass('md-icon-right'); }
104+
105+
return function postLink(scope, element) {
106+
$mdTheming(element);
107+
};
106108
}
107109

108110
function ContainerCtrl($scope, $element, $attrs, $animate) {
@@ -529,7 +531,8 @@ function inputTextareaDirective($mdUtil, $window, $mdAria, $timeout, $mdGesture)
529531
var container = containerCtrl.element;
530532
var dragGestureHandler = $mdGesture.register(handle, 'drag', { horizontal: false });
531533

532-
element.after(handle);
534+
535+
element.wrap('<div class="md-resize-wrapper">').after(handle);
533536
handle.on('mousedown', onMouseDown);
534537

535538
container

src/components/input/input.scss

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,6 @@ md-input-container {
4848
min-width: 1px;
4949
}
5050

51-
.md-resize-handle {
52-
position: absolute;
53-
bottom: $input-error-height - $input-border-width-default * 2;
54-
left: 0;
55-
height: $input-resize-handle-height;
56-
background: transparent;
57-
width: 100%;
58-
cursor: ns-resize;
59-
}
60-
6151
> md-icon {
6252
position: absolute;
6353
top: $icon-top-offset;
@@ -385,6 +375,21 @@ md-input-container {
385375
}
386376
}
387377

378+
.md-resize-wrapper {
379+
@include pie-clearfix();
380+
position: relative;
381+
}
382+
383+
.md-resize-handle {
384+
position: absolute;
385+
bottom: $input-resize-handle-height / -2;
386+
left: 0;
387+
height: $input-resize-handle-height;
388+
background: transparent;
389+
width: 100%;
390+
cursor: ns-resize;
391+
}
392+
388393
@media screen and (-ms-high-contrast: active) {
389394
md-input-container.md-default-theme > md-icon {
390395
fill: #fff;

0 commit comments

Comments
 (0)