Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,7 @@ test.describe(`${TAG.FUNCTIONAL}`, () => {
expect(lineCount).toBe(2);
await expect(locators.counter(page)).toHaveText('1/10of 10 lines');

const firstLineText = await locators.row(page, 0).textContent();

expect(firstLineText).not.toMatch(/^http:\/\//);
await expect(locators.row(page, 0)).not.toHaveText(/^http:\/\//);

await locators.button(page, 'Clear all').click();
await page.waitForTimeout(100);
Expand Down
18 changes: 10 additions & 8 deletions semcore/bulk-textarea/src/BulkTextarea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,22 +234,24 @@ class BulkTextareaRoot<T extends string | string[]> extends Component<
this.handlers.showErrors(false);
this.handlers.errors([]);
this.handlers.state('normal');

if (document.activeElement === this.clearAllButtonRef.current) {
const textarea = this.inputFieldRef.current?.querySelector('[role="textbox"]');

if (textarea instanceof HTMLDivElement) {
textarea.focus();
}
}
}
};

handleClickClearAll = (e: Event) => {
this.handlers.showErrors(false);
this.handlers.errors([]);
this.setState({ errorIndex: -1 });
// @ts-ignore
this.handlers.value('', e);
// @ts-ignore (we should set right type of value depending on the type of value passed)
this.handlers.value(typeof this.asProps.value === 'string' ? '' : [], e);
this.handlers.state('normal');

const textarea = this.inputFieldRef.current?.querySelector('[role="textbox"]');

if (textarea instanceof HTMLDivElement) {
textarea.focus();
}
};

handleChangeErrorIndex = (amount: number) => () => {
Expand Down
10 changes: 8 additions & 2 deletions semcore/bulk-textarea/src/components/InputField/InputField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,11 @@ class InputField<T extends string | string[]> extends Component<

if (paragraph instanceof HTMLParagraphElement) {
if (newValue === '') {
paragraph.innerHTML = this.emptyLineValue;
if (lines.length === 1) {
this.textarea.textContent = '';
} else {
paragraph.innerHTML = this.emptyLineValue;
}
} else {
paragraph.replaceChild(newValueTextNode, paragraph.childNodes.item(0));
}
Expand Down Expand Up @@ -638,7 +642,9 @@ class InputField<T extends string | string[]> extends Component<
onBlur(valueToChange as T, event);

setTimeout(() => {
this.setState({ keyboardLineIndex: -1 });
if (document.activeElement !== this.textarea) {
this.setState({ keyboardLineIndex: -1 });
}
}, 200);
}

Expand Down
4 changes: 3 additions & 1 deletion semcore/dropdown-menu/src/DropdownMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,9 @@ function List({ styles, Children }) {
const SScrollContainer = ScrollAreaComponent.Container;

const preventFocusByClick = React.useCallback((e) => {
e.preventDefault();
if (!e.target.draggable) {
e.preventDefault();
}
}, []);

return sstyled(styles)(
Expand Down
Loading