In our unit tests, we sometimes want to be able to use the ByTestId methods of the React Testing Library to find bits of DOM created by a Kendo component. However, setting a data-testid attribute (or really any data- attribute) on a Kendo component does not always result in the attribute appearing anywhere in the final DOM.
To demonstrate, below is a test suite (also included in the zip) where I tried putting a data-testid attribute on the Kendo components Input, TextArea, Checkbox, Slider, SliderLabel, MultiSelect, and DatePicker, then checked if the attribute appeared in the rendered DOM. The tests for Input, TextArea, and Checkbox are successful. The ones for Slider, SliderLabel, MultiSelect, and DatePicker are not.
import { render, screen } from '@testing-library/react';
import { Input, TextArea, Checkbox, Slider, SliderLabel } from '@progress/kendo-react-inputs';
import { MultiSelect } from '@progress/kendo-react-dropdowns';
import { DatePicker } from '@progress/kendo-react-dateinputs';
// SUCCEEDS
describe('Kendo Input', () => {
it('supports data attributes', () => {
render(
<Input data-testid="the-input" />
);
const input = screen.queryByTestId('the-input');
expect(input).toBeTruthy();
});
});
// SUCCEEDS
describe('Kendo TextArea', () => {
it('supports data attributes', () => {
render(
<TextArea data-testid="the-text-area" />
);
const textarea = screen.queryByTestId('the-text-area');
expect(textarea).toBeTruthy();
});
});
// SUCCEEDS
describe('Kendo Checkbox', () => {
it('supports data attributes', () => {
render(
<Checkbox label={"Chad"} data-testid="the-checkbox" />
);
const checkbox = screen.queryByTestId('the-checkbox');
expect(checkbox).toBeTruthy();
});
});
// FAILS
describe('Kendo Slider & SliderLabel', () => {
it('supports data attributes', () => {
render(
<Slider min={1} max={2} data-testid="slider-root">
<SliderLabel position={1} data-testid="slider-label-1">One Fish</SliderLabel>
<SliderLabel position={2} data-testid="slider-label-2">Two Fish</SliderLabel>
</Slider>
);
const sliderRoot = screen.queryByTestId('slider-root');
const sliderLabel1 = screen.queryByTestId('slider-label-1');
const sliderLabel2 = screen.queryByTestId('slider-label-2');
// test them all at once so we can know the full scope of our failure/success
expect({
sliderRoot,
sliderLabel1,
sliderLabel2
}).toMatchObject({
sliderRoot: expect.anything(), // don't be null or undefined
sliderLabel1: expect.anything(), // don't be null or undefined
sliderLabel2: expect.anything() // don't be null or undefined
});
});
});
// FAILS
describe('Kendo MultiSelect', () => {
it('supports data attributes', () => {
render(
<MultiSelect data-testid="the-multi-select" />
);
const multiselect = screen.queryByTestId('the-multi-select');
expect(multiselect).toBeTruthy();
});
});
// FAILS
describe('Kendo DatePicker', () => {
it('supports data attributes', () => {
render(
<DatePicker data-testid="the-date-picker" />
);
const datepicker = screen.queryByTestId('the-date-picker');
expect(datepicker).toBeTruthy();
});
});
Hello
I'm using the menu component version 4.13
I'd like to change the style of the active menu item but could not find any examples. Here's one of my menu items
i'm following your example to do the routing
I'm using react router dom.
Do you have an example for how to change the css of the active menu item?
Thank you.
Fabian
Hi there,
I can see there is a column chooser component for the Angular Data Grid e.g. https://www.telerik.com/kendo-angular-ui/components/grid/columns/menu/#toc-column-chooser-item but there is not an equivalent for the React Data Grid (unless you code it yourself).
The DevExpress React Grid does have this feature https://devexpress.github.io/devextreme-reactive/react/grid/docs/guides/column-visibility/ so we were wondering if such a thing is planned React Data Grid?
Thanks very much,
James
On this page: https://www.telerik.com/kendo-react-ui/getting-started/
There's a syntax mismatch in end-of-line semicolons.
This line ends with a semicolon:
```js
import '@progress/kendo-theme-default/dist/all.css';
```
This line does not end with a semicolon:
```js
import { Calendar } from '@progress/kendo-react-dateinputs'
```
All teams that I know of consider it to be an error to do both ways in the same file.
The solution is to pick one way then be consistent. The broader solution is to use a linter, such as ESLint, that can process the code to ensure you're using your expected syntax and formatting.
A horizontal scroller or scroll list? A list of items or chips can be scrolled through horizontally, either by using arrow buttons or drag.
This is a common way of accessing a long list of items on a phone - by swiping left or right on the list with your finger.
There are a couple of horizontal scroller controls available for react - but they are not complete, buggy and not supported.
The `Surface` component, in the drawing module, has a few exposed event handlers. It exposes click, mouse enter and mouse leave. It does not expose a handler for mouse scroll wheel movement.
You can see the exposed handlers in the `SurfaceOptions` type ...
SurfaceOptions - React Drawing Component | KendoReact API (telerik.com)
Can you please expose the mouse scroll event handler?
React v18 has been released.
It appears that KendoReact only supports up to v17 (dependency conflicts if you try to use v18).
Can you please add support for React v18?
Thanks!
A TimePicker control will take all scroll events if the mouse cursor is over it, whether the element has focus or not, and prevent the scroll from bubbling up to the page. This prevents a page from scrolling as soon as the mouse cursor touches a TimePicker.
Using Kendo rect v5.1.0 in FireFox v98 on OSX. (Issue does not happen in Chrome)
You can view the problem in the demo page: https://www.telerik.com/kendo-react-ui/components/dateinputs/timepicker/
Just try to scroll down the view, and as soon as the TimePicker is under the mouse cursor, the page can no longer be scrolled until you move the cursor off the control.
Set up a TimePicker with a `min` and `max`. For example
min={new Date(0, 0, 0, 0, 0)} max={new Date(0, 0, 0, 5, 0)}
Click on the text input to focus the 'hours' portion.
Roll the mouse scrollwheel up/down to change the hours.
You can 'scroll' past 5:00 and set the time to anything above the max.
You can also use the keyboard to enter any number outside the min/max.
Is this the expected behavior? Do we always have to add our own validation to check the min/max ourselves?
After updating the kendo version in my project to "^5.1.0" I've noticed that both grid pager dropdown and normal dropdowns won't close when clicked outside if the dropdown is opened using the arrow icon.
I've attached a video with the issue.
Is there any workaround for this?
I use a Datepicker with 'he' loclae. It works fine, but the week's days are displayed from left to right instead of right to left as expected.
I tried to add className = 'k-rtl' but it did not help.
Is there a way to change that?
Here is a demonstration of the problem:
https://stackblitz.com/edit/react-vkzwzo?file=app%2Fmain.jsx
There is an inconsistency with the DateRange picker in the way element focus is set when closing the date selection popup by mouse vs keyboard. When using the mouse to close the date range selection popup, element focus becomes lost/reset.
You can simulate this from the example page https://www.telerik.com/kendo-react-ui/components/dateinputs/daterangepicker/
Steps to simulate good behavior (this works correctly):
* click the 'from' input text element (causes the popup to open and the text input to have focus)
* press 'escape' to close the popup (the popup is closed, and the 'from' input element retains focus)
* press 'tab' (focus moves to the 'to' text input element)
Steps to simulate behavior that could be improved:
* click or tab into the 'from' input element (causes the popup to open and the text input to have focus)
* click (with the mouse) outside the popup to close it (the popup is closed, and focus appears to be lost.)
* press 'tab' (focus moves to the 'from' input element again because we are back at the beginning of the tab order list)
This input can lead you into a tab order loop if you mix pressing 'tab' to advance focus, and using the mouse to click to close the date selection popup.
Feature request: when clicking to close the popup, element focus should be retained in the 'from' or 'to' text input; whichever had focus before the popup close, the same as pressing 'escape' to close the popup.
Hi,
I'm using GridColumnMenuCheckboxFilter in column that holds dates, but the dates shown within the GridColumnMenuCheckboxFilter are not formatted.
Is there a way to format the dates like dd/mm/yyyy?
Here is an axample: https://stackblitz.com/edit/react-4cxw2e?file=app/main.jsx
Thank you!
Hi,
The Telerik example for Inline Editing with Custom Editors uses a dropdown list with reference data hardcoded into the custom dropdown cell. This isn't a realistic scenario for for production code with dynamic reference data. If you pass the reference data for the dropdown to the custom cell then the dropdown loses focus every time you change the selected value. This can be seen by shifting the localizedData in the Telerik example referenced earlier from myDropDownCell.tsx to main and passing it as a parameter: https://stackblitz.com/edit/react-9ycz1i?file=app/main.tsx
Is there a workaround for this issue?
Kind regards,
David
Hi Team,
While navigating using keyboard tab key focus is not moving to multiple controls such as Bar graphs and legends in kendo React Charts.
Screen reader should narrate proper name, role and value for the controls.
NVDA Focus is not moving to the bar graphs and legends and it is not narrating proper value for the bar graphs and legends.
which includes following components
Can you please suggest if any,
Thanks & Regards,
Sairoopa.Ch
Hi,
Using KendoReact Scheduler component the functionality to group the events by date, then by resources is not supported. I can only group them by resources first, then by date.
This feature exists in Kendo for jQuery Scheduler component and can be configured by setting the group.date property to true as following:
group: {
date: true,
resources: ["Rooms"]
}
resulting in something similar as in the picture below.
We need the same functionality in KendoReact Scheduler component as well.
Thanks,
Camelia