diff --git a/core/src/main/resources/hudson/model/View/newJob.jelly b/core/src/main/resources/hudson/model/View/newJob.jelly index c37a22c836..bde4103da3 100644 --- a/core/src/main/resources/hudson/model/View/newJob.jelly +++ b/core/src/main/resources/hudson/model/View/newJob.jelly @@ -37,7 +37,7 @@ THE SOFTWARE.
- +
» ${%ItemName.help}
» ${%ItemName.validation.required}
@@ -45,7 +45,7 @@ THE SOFTWARE.
-
+
diff --git a/war/src/main/js/add-item.js b/war/src/main/js/add-item.js index a15af8eacc..c896383a9d 100644 --- a/war/src/main/js/add-item.js +++ b/war/src/main/js/add-item.js @@ -13,7 +13,7 @@ var getItems = function(){ var jRoot = $('head').attr('data-rooturl'); -$.when(getItems()).done(function(data){ +$.when(getItems()).done(function(data) { $(function() { ////////////////////////// @@ -87,7 +87,7 @@ $.when(getItems()).done(function(data){ function drawCategory(category) { var $category = $('
').addClass('category').attr('id', 'j-add-item-type-' + cleanClassName(category.id)); - var $items = $('').addClass('j-item-options'); + var $items = $('
    ').addClass('j-item-options'); var $catHeader = $('
    '); var title = '

    ' + category.name + '

    '; var description = '

    ' + category.description + '

    '; @@ -107,23 +107,37 @@ $.when(getItems()).done(function(data){ function drawItem(elem) { var desc = checkForLink(elem.description); - var $item = $(['
  • '].join('')).append(['
    ', desc, '
    '].join('')).append(drawIcon(elem)); - function setSelectState(e) { + function select(e) { e.preventDefault(); - var $this = $(this).closest('li'); - $this.closest('.categories').find('input[type="radio"][name="mode"]').removeAttr('checked'); - $this.closest('.categories').find('.active').removeClass('active'); - $this.addClass('active'); - $this.find('input[type="radio"][name="mode"]').prop('checked', true); + $('li[role="radio"]').attr("aria-checked", "false"); + $(this).find('input[type="radio"][name="mode"]').removeAttr('checked'); + $(this).parents().find('.active').removeClass('active'); + + $(this).attr("aria-checked", "true"); + $(this).find('input[type="radio"][name="mode"]').prop('checked', true); + $(this).addClass('active'); + $('input[type="text"][name="from"]', '#createItem').val(''); cleanValidationMessages('.add-item-copy'); if (isItemNameEmpty()) { activateValidationMessage('#itemname-required', '.add-item-name'); } } - $item.click(setSelectState); + + $item.click(select); + + $item.keypress(function(e) { + switch (e.which) { + case 13: + case 32: + $(this).trigger('click'); + e.stopPropagation(); + break; + } + }); return $item; } @@ -180,14 +194,14 @@ $.when(getItems()).done(function(data){ }); // Init CopyFromField - $('input[name="from"]', '#createItem').focus(function() { - $('#createItem').find('input[type="radio"][value="copy"]').prop('checked', true); - $('.categories').find('.active').removeClass('active'); - }); - $('input[name="from"]', '#createItem').blur(function() { if (getCopyFromValue() === '') { - $('#createItem').find('input[type="radio"][value="copy"]').prop('checked', false); + $('#createItem').find('input[type="radio"][value="copy"]').removeAttr('checked'); + } else { + $('.categories').find('li[role="radio"]').attr("aria-checked", "false"); + $('#createItem').find('input[type="radio"][name="mode"]').removeAttr('checked'); + $('.categories').find('.active').removeClass('active'); + $('#createItem').find('input[type="radio"][value="copy"]').prop('checked', true); } }); diff --git a/war/src/main/js/widgets/add/addform.less b/war/src/main/js/widgets/add/addform.less index 052379a943..90c5835d19 100644 --- a/war/src/main/js/widgets/add/addform.less +++ b/war/src/main/js/widgets/add/addform.less @@ -287,6 +287,7 @@ li:hover, li:focus { border-color: #cccccc; background: rgba(255, 255, 255, 0.65); + outline: 0; } li.active {