Skip to content

Commit 2ccc6fd

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent 918b236 commit 2ccc6fd

File tree

8 files changed

+233
-6
lines changed

8 files changed

+233
-6
lines changed

docs/api/javascript/ui/notification.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,20 @@ Defines a Kendo UI template to be used with the corresponding notification type.
357357

358358
See the [example above](/api/javascript/ui/notification#configuration-templates).
359359

360+
### title `String` *(default: null)*
361+
362+
Defines the title attribute value for the Notification wrapper.
363+
364+
#### Example
365+
366+
<span id="notification"></span>
367+
<script>
368+
$("#notification").kendoNotification({
369+
title: "Custom title"
370+
});
371+
$("#notification").getKendoNotification().show("Kendo Notification");
372+
</script>
373+
360374
### width `Number|String` *(default: null)*
361375

362376
Defines the notifications' width. Numbers are treated as pixels.
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
---
2+
title: Align Zero With Multiple Axes in Chart
3+
page_title: Align Zero With Multiple Axes in Chart | Kendo UI Chart for jQuery
4+
description: An example on how to align the zero value for multiple value axes in a Kendo UI Chart.
5+
type: how-to
6+
slug: chart-align-zero-multiple-axes
7+
tags: chart, align, zero, multiple, axes
8+
res_type: kb
9+
---
10+
11+
## Environment
12+
13+
<table>
14+
<tr>
15+
<td>Product</td>
16+
<td>Chart for Progress® Kendo UI®</td>
17+
</tr>
18+
</table>
19+
20+
## Description
21+
22+
I have a chart with multiple axes. One has negavive values and the other does not. I want the zero on the two axes to be aligned and to show the negative values on one axis.
23+
24+
## Solution
25+
26+
1. Update the [min](https://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart/configuration/valueaxis.min) and [max](https://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart/configuration/valueaxis.max) setting for the value axes so they include both positive and negative values.
27+
1. Specify a function for the [valueAxis.labels.template](https://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart/configuration/valueaxis.labels#valueaxislabelstemplate) of the axes where only positive values should be displayed.
28+
1. Check the values in the template handler and return only the positive values. For the negative values return an empty string.
29+
30+
31+
```dojo
32+
<div id="chart"></div>
33+
</div>
34+
35+
<script>
36+
function onlyPositive(e) {
37+
if (e.value < 0) {
38+
return '';
39+
}
40+
41+
return e.value;
42+
}
43+
44+
45+
$("#chart").kendoChart({
46+
title: {
47+
text: "Hybrid car mileage report"
48+
},
49+
legend: {
50+
position: "top"
51+
},
52+
series: [{
53+
type: "column",
54+
data: [20, 40, 45, 30, 50],
55+
stack: true,
56+
name: "on battery",
57+
color: "#cc6e38"
58+
}, {
59+
type: "column",
60+
data: [20, 30, 35, 35, 40],
61+
stack: true,
62+
name: "on gas",
63+
color: "#ef955f"
64+
}, {
65+
type: "line",
66+
data: [30, 38, 40, 32, 42],
67+
name: "mpg",
68+
color: "#ec5e0a",
69+
axis: "mpg"
70+
}, {
71+
type: "line",
72+
data: [-7.8, 6.2, 5.9, 7.4, 5.6],
73+
name: "l/100 km",
74+
color: "#4e4141",
75+
axis: "l100km"
76+
}],
77+
valueAxes: [{
78+
title: { text: "miles" },
79+
min: -100,
80+
max: 100,
81+
labels: { template: onlyPositive }
82+
}, {
83+
name: "km",
84+
title: { text: "km" },
85+
min: -192,
86+
max: 192,
87+
majorUnit: 32,
88+
labels: { template: onlyPositive }
89+
}, {
90+
min: -60,
91+
max: 60,
92+
name: "mpg",
93+
title: { text: "miles per gallon" },
94+
color: "#ec5e0a",
95+
labels: { template: onlyPositive }
96+
}, {
97+
name: "l100km",
98+
title: { text: "liters per 100km" },
99+
color: "#4e4141"
100+
}],
101+
categoryAxis: {
102+
categories: ["Mon", "Tue", "Wed", "Thu", "Fri"],
103+
// Align the first two value axes to the left
104+
// and the last two to the right.
105+
//
106+
// Right alignment is done by specifying a
107+
// crossing value greater than or equal to
108+
// the number of categories.
109+
axisCrossingValues: [0, 0, 10, 10]
110+
}
111+
});
112+
113+
</script>
114+
```

docs/knowledge-base/open-column-visibility-menu-on-right-click-on-header.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ How can I create a popup menu for toggling the visibility of the Kendo UI Grid c
3030

3131
The following example demonstrates how to apply the necessary approach.
3232

33-
```
33+
```dojo
3434
<div id="example">
3535
<div id="grid"></div>
3636

src/kendo.draganddrop.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,8 @@ var __meta__ = { // jshint ignore:line
921921
}
922922
});
923923

924+
clearInterval(this._scrollInterval);
925+
this._scrollInterval = null;
924926
this._cancel(this._trigger(DRAGEND, e));
925927
},
926928

src/kendo.notification.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ var __meta__ = { // jshint ignore:line
3838
RIGHT = "right",
3939
UP = "up",
4040
NS = ".kendoNotification",
41-
WRAPPER = '<div class="k-widget k-popup k-notification"></div>',
41+
WRAPPER = '<div role="alert" aria-live="polite" class="k-widget k-popup k-notification"></div>',
4242
TEMPLATE = '<div class="k-notification-wrap">' +
43-
'<span class="k-icon k-i-#=typeIcon#" title="#=typeIcon#"></span>' +
43+
'<span class="k-icon k-i-#:typeIcon#" title="#:typeIcon#"></span>' +
4444
'<div class="k-notification-content">#=content#</div>' +
45-
'<span class="#: closeButton ? "" : "k-hidden"# k-icon k-i-close" title="Hide"></span>' +
45+
'<span aria-hidden="true" class="#: closeButton ? "" : "k-hidden"# k-icon k-i-close" title="Hide"></span>' +
4646
'</div>',
4747
SAFE_TEMPLATE = TEMPLATE.replace("#=content#", "#:content#");
4848

@@ -89,6 +89,7 @@ var __meta__ = { // jshint ignore:line
8989
width: null,
9090
height: null,
9191
templates: [],
92+
title: null,
9293
animation: {
9394
open: {
9495
effects: "fade:in",
@@ -353,12 +354,15 @@ var __meta__ = { // jshint ignore:line
353354
var that = this,
354355
options = that.options,
355356
wrapper = $(WRAPPER),
357+
contentId = kendo.guid(),
356358
args, defaultArgs;
357359

358360
if (!type) {
359361
type = INFO;
360362
}
361363

364+
wrapper.attr("aria-label", type);
365+
362366
if (content !== null && content !== undefined && content !== "") {
363367

364368
if (kendo.isFunction(content)) {
@@ -377,10 +381,16 @@ var __meta__ = { // jshint ignore:line
377381
.addClass(KNOTIFICATION + "-" + type)
378382
.toggleClass(KNOTIFICATION + "-button", options.button)
379383
.toggleClass(KNOTIFICATION + "-closable", options.button)
380-
.attr("data-role", "alert")
384+
.attr({
385+
"data-role": "alert",
386+
title: options.title
387+
})
381388
.css({width: options.width, height: options.height})
382389
.append(that._getCompiled(type, safe)(args));
383390

391+
wrapper.find(".k-notification-content").attr("id", contentId);
392+
wrapper.attr("aria-describedby", contentId);
393+
384394
that.angular("compile", function(){
385395
return {
386396
elements: wrapper,

tests/notification/aria.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
(function() {
2+
describe("Notification WAI-ARIA", function() {
3+
beforeEach(function() {
4+
5+
});
6+
afterEach(function() {
7+
if (notification) {
8+
notification.destroy();
9+
}
10+
$(".k-notification").each(function(idx, element) {
11+
var popup = $(element).data("kendoPopup");
12+
if (popup) {
13+
popup.destroy();
14+
}
15+
$(element).remove();
16+
});
17+
});
18+
19+
it("Notification has appropriate role", function() {
20+
createNotification();
21+
notification.show("foo");
22+
23+
var element = $(".k-notification");
24+
25+
assert.equal(element.attr("role"), "alert");
26+
});
27+
28+
it("Notification has appropriate aria-live", function() {
29+
createNotification();
30+
notification.show("foo");
31+
32+
var element = $(".k-notification");
33+
34+
assert.equal(element.attr("aria-live"), "polite");
35+
});
36+
37+
it("Notification has appropriate aria-label", function() {
38+
createNotification();
39+
notification.show("foo", "error");
40+
41+
var element = $(".k-notification");
42+
43+
assert.equal(element.attr("aria-label"), "error");
44+
});
45+
46+
it("Notification has appropriate aria-describedby", function() {
47+
createNotification();
48+
notification.show("foo", "error");
49+
50+
var element = $(".k-notification");
51+
52+
assert.equal(element.attr("aria-describedby"), element.find(".k-notification-content").attr("id"));
53+
});
54+
55+
it("Notification close button has aria-hidden set", function() {
56+
createNotification({
57+
button: true
58+
});
59+
notification.show("foo");
60+
61+
var element = $(".k-notification .k-i-close");
62+
63+
assert.equal(element.attr("aria-hidden"), "true");
64+
});
65+
66+
it("Notification does not violate AXE", function(done) {
67+
createNotification({
68+
button: true
69+
});
70+
notification.show("foo");
71+
72+
axeRun($(".k-notification").parent(), done);
73+
});
74+
});
75+
}());

tests/notification/initialization.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107

108108
var defaultFunc = notification._getCompiled();
109109
var params = { typeIcon: "info", content: "foo", closeButton: false };
110-
var defaultOutput = '<div class="k-notification-wrap"><span class="k-icon k-i-info" title="info"></span><div class="k-notification-content">foo</div><span class="k-hidden k-icon k-i-close" title="Hide"></span></div>';
110+
var defaultOutput = '<div class="k-notification-wrap"><span class="k-icon k-i-info" title="info"></span><div class="k-notification-content">foo</div><span aria-hidden="true" class="k-hidden k-icon k-i-close" title="Hide"></span></div>';
111111

112112
assert.equal(typeof defaultFunc, "function");
113113
assert.equal(defaultFunc(params), defaultOutput);
@@ -308,6 +308,17 @@
308308
}, 400);
309309
});
310310

311+
it("title is applied to the Notification element", function() {
312+
createNotification({
313+
title: "custom title"
314+
});
315+
notification.show("foo");
316+
317+
var element = $(".k-notification");
318+
319+
assert.equal(element.attr("title"), "custom title");
320+
});
321+
311322
it("hide button is displayed if button property is set to true", function() {
312323
createNotification({
313324
button: true

typescript/kendo.all.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7173,6 +7173,7 @@ declare namespace kendo.ui {
71737173
position?: NotificationPosition;
71747174
stacking?: string;
71757175
templates?: NotificationTemplate[];
7176+
title?: string;
71767177
width?: number|string;
71777178
hide?(e: NotificationHideEvent): void;
71787179
show?(e: NotificationShowEvent): void;

0 commit comments

Comments
 (0)