From e7d857ac9c432445f7fb73d3913681273a96d6ca Mon Sep 17 00:00:00 2001 From: Lauren V Caple Date: Tue, 19 Dec 2023 14:18:51 -0800 Subject: [PATCH] bugfix: radio/checkbox display issues --- CHANGELOG.md | 4 ++++ README.md | 2 +- js/2014.min.js | 2 +- js/2014/radio.js | 2 +- style.css | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41fdbdc..6654c46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2023-12-19 3.0.1 + +- Bug fix: radio buttons and checkboxes not displaying properly + ## 2023-8-4 3.0.0 - Upgraded jQuery version diff --git a/README.md b/README.md index 66b7141..687f32e 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # UW WordPress Theme -![UW WordPress Theme version 3.0.0](https://img.shields.io/static/v1?label=version&message=v3.0.0&color=green) +![UW WordPress Theme version 3.0.1](https://img.shields.io/static/v1?label=version&message=v3.0.1&color=green) Please visit the [theme Wiki pages](https://github.com/uweb/uw_wp_theme/wiki) for more information on changes from the uw-2014 theme, Bootstrap features, child themes, and developer documentation. diff --git a/js/2014.min.js b/js/2014.min.js index 35f30c3..cc84ec6 100644 --- a/js/2014.min.js +++ b/js/2014.min.js @@ -1,7 +1,7 @@ "use strict";var root=window.document,UW=function e(o){return o instanceof e?o:this instanceof e?void(this._wrapped=o):new e(o)};(root.UW=UW).VERSION="0.1",UW.KEYCODES={TAB:9,ENTER:13,ESC:27},UW.elements={alert:".site-header",radio:":radio",checkbox:":checkbox",search:"#uwsearcharea",select:".uw-select",quicklinks:".uw-quicklinks"},UW.getBaseUrl=function(){var e=_.first(_.compact(Backbone.history.location.pathname.split("/")));return Backbone.history.location.origin||(Backbone.history.location.origin=Backbone.history.location.protocol+"//"+Backbone.history.location.hostname+(Backbone.history.location.port?":"+Backbone.history.location.port:"")),-1!=Backbone.history.location.origin.indexOf("www.washington.edu")?Backbone.history.location.origin+(e?"/"+e:"")+"/":-1!=Backbone.history.location.origin.indexOf("depts.washington.edu")?Backbone.history.location.origin+(e?"/"+e:"")+"/":Backbone.history.location.origin+"/"},UW.wpinstance=function(){return Backbone.history.location.pathname?Backbone.history.location.pathname:""},UW.sources={search:UW.getBaseUrl()+"wp-admin/admin-ajax.php"},UW.initialize=function(e){UW.$body=e("body"),UW.$window=e(window),UW.baseUrl=UW.getBaseUrl(),UW.alert=new UW.Alert({after:UW.elements.alert,model:new UW.Alert.Model}),UW.quicklinks=_.map(e(UW.elements.quicklinks),function(e){return new UW.QuickLinks({el:e})}),UW.radio=_.map(e(UW.elements.radio),function(e){return new UW.Radio({el:e})}),UW.checkbox=_.map(e(UW.elements.checkbox),function(e){return new UW.Radio({el:e})}),UW.select=_.map(e(UW.elements.select),function(e){return new UW.Select({el:e})})},jQuery(document).ready(function(){UW.initialize(jQuery)}); "use strict";UW.Alert=Backbone.View.extend({alert:"#uwalert-alert-message",events:{"click .close":"hide"},template:'
Close

<%= title %>

<%= excerpt %>More info

',initialize:function(e){_.bindAll(this,"render","hide"),this.options=_.extend({},e),this.model.on("sync",this.render)},render:function(){this.model.get("title")&&($(this.options.after).after(_.template(this.template)(this.model.toJSON())),this.setElement($(this.alert)))},hide:function(){this.$el.remove()}}),UW.Alert.Model=Backbone.Model.extend({alerts:["red-alert-urgent","orange-alert","steel-alert-fyis"],data:{c:"?",test:!0,number:1,type:"post",status:"publish",dataType:"json"},url:"https://public-api.wordpress.com/rest/v1/sites/uwemergency.wordpress.com/posts/",initialize:function(){this.fetch({data:this.data})},parse:function(e){var t=_.first(e.posts);if(_.extend(t.categories,{alert:{slug:window.location.hash.replace("#","")}}),_.intersection(_.pluck(t.categories,"slug"),this.alerts).length||-1!==t.categories.alert.slug.indexOf("uwalert"))return t}}); "use strict";UW.QuickLinks=Backbone.View.extend({container:"#page",events:{click:"animate",touchstart:"animate",keyup:"animate",blur:"loop"},initialize:function(i){_.bindAll(this,"inner_keydown","render","animate","accessible","loop","transitionEnd"),this.render()},render:function(){this.quicklinks=$("#quicklinks"),this.$container=$(this.container),this.$el.attr("aria-controls","quicklinks").attr("aria-owns","quicklinks"),UW.$body.on("keydown","#quicklinks",this.inner_keydown),UW.$body.on("keyup","#quicklinks a",this.animate),this.quicklinks.on("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",this.transitionEnd)},transitionEnd:function(i){this.open&&i.target==this.quicklinks[0]&&this.accessible()},inner_keydown:function(i){var n=this.quicklinks.find("a"),t=n[0],e=n[n.length-1],s=$("#little-links").find("a"),a=$("#big-links").find("a"),o=s[0],r=a[a.length-1];if(this.quicklinks.hasClass("open")){if(9==i.keyCode&&i.shiftKey)return $(":focus")[0]===t?(e.focus(),i.preventDefault()):$(":focus")[0]===o?(r.focus(),i.preventDefault()):$(":focus").closest("li").prev().find("a").trigger("focus"),!1;9==i.keyCode&&$(":focus")[0]===e&&(t.focus(),i.preventDefault())}},animate:function(i){if(i.preventDefault(),i.keyCode&&27!=i.keyCode&&(i.keyCode&&13!=i.keyCode||i.keyCode&&32!=i.keyCode))return!1;this.$container.toggleClass("open"),this.quicklinks.toggleClass("open"),this.open=this.quicklinks.hasClass("open"),this.loop(),this.accessible()},accessible:function(i){this.$el.attr("aria-expanded",this.open),this.quicklinks.attr("aria-hidden",(!this.open).toString()),this.open?(this.$el.attr("aria-label","Close quick links"),this.quicklinks.find("a").attr("tabindex",0).first().focus(),$("#page-inner").attr("aria-hidden",!0),$(".screen-reader-shortcut").attr("aria-hidden",!0)):(this.$el.attr("aria-label","Open quick links"),this.quicklinks.find("a").attr("tabindex",-1),this.$el.focus(),$("#page-inner").attr("aria-hidden",!1),$(".screen-reader-shortcut").attr("aria-hidden",!1))},loop:function(i){this.quicklinks.hasClass("open")&&this.quicklinks.find("li a").first().focus()}}); -"use strict";UW.Radio=Backbone.View.extend({states:{checked:"checked",disabled:"disabled"},events:{"click input":"toggle"},initialize:function(t){_.bindAll(this,"toggle","getGroup","toggleCheckBox"),this.settings=_.extend({},this.defaults,this.$el.data(),t),this.$input=this.$el,this.name=this.$el.attr("name"),this.setElement(this.$el.closest("label")),this.setState()},setState:function(){this.$input.prop(this.states.disabled)&&this.$el.addClass(this.states.disabled),this.$input.prop(this.states.checked)&&this.$el.addClass(this.states.checked)},getGroup:function(){return"radio"===this.$input.attr("type")?_.where(UW.radio,{name:this.name}):"checkbox"===this.$input.attr("type")?_.where(UW.checkbox,{name:this.name}):void 0},toggle:function(t){_.each(this.getGroup(),this.toggleCheckBox)},toggleCheckBox:function(t){var e=t.$input.prop(this.states.checked),s=t.$input.prop(this.states.disabled);!s&&t.$el.removeClass(this.states.checked)&&t.$el.removeAttr(this.states.checked).trigger("change"),s||(e&&t.$el.addClass(this.states.checked)&&t.$el.trigger($.Event("toggle")),e!==t.$el.prop(this.states.checked)&&t.$el.trigger("change"))}}); +"use strict";UW.Radio=Backbone.View.extend({states:{checked:"checked",disabled:"disabled"},events:{"click input":"toggle"},template:'',initialize:function(t){_.bindAll(this,"toggle","getGroup","toggleCheckBox"),this.settings=_.extend({},this.defaults,this.$el.data(),t),this.$el.after(this.template),this.$input=this.$el,this.name=this.$el.attr("name"),this.setElement(this.$el.closest("label")),this.setState()},setState:function(){this.$input.prop(this.states.disabled)&&this.$el.addClass(this.states.disabled),this.$input.prop(this.states.checked)&&this.$el.addClass(this.states.checked)},getGroup:function(){return"radio"===this.$input.attr("type")?_.where(UW.radio,{name:this.name}):"checkbox"===this.$input.attr("type")?_.where(UW.checkbox,{name:this.name}):void 0},toggle:function(t){_.each(this.getGroup(),this.toggleCheckBox)},toggleCheckBox:function(t){var e=t.$input.prop(this.states.checked),s=t.$input.prop(this.states.disabled);!s&&t.$el.removeClass(this.states.checked)&&t.$el.removeAttr(this.states.checked).trigger("change"),s||(e&&t.$el.addClass(this.states.checked)&&t.$el.trigger($.Event("toggle")),e!==t.$el.prop(this.states.checked)&&t.$el.trigger("change"))}}); "use strict";jQuery(".uw-recent a.feed").off("click").on("click",function(e){e.preventDefault(),jQuery(".uw-recent p.feed").toggleClass("hide"),jQuery(".uw-recent p.feed > input").trigger("select")}); "use strict";var body=document.getElementsByTagName("body"),searchArea=document.getElementById("uwsearcharea"),searchButton=document.querySelector("button.uw-search"),radiobtn=document.getElementsByClassName("radiobtn"),mobileSelect=document.getElementById("mobile-search-select"),form=document.querySelector("form.uw-search"),searchLabels=document.getElementById("search-labels"),submitButton=document.querySelector("input.search"),radioLabel=document.getElementsByClassName("radio"),url=window.location.href,searchSite=searchArea.dataset.search,searchBar=document.getElementById("uw-search-bar");function switchAction(){"uw"===searchSite?(form.action="https://uw.edu/search",searchBar.setAttribute("name","q")):(form.action=$("form.uw-search").data("sitesearch"),searchBar.setAttribute("name","s"))}function toggleSearchArea(){document.body.classList.toggle("search-open")}function setAttributes(e,t){for(var a in t)e.setAttribute(a,t[a])}function toggleBlur(){document.body.classList.contains("search-open")?(searchArea.hidden=!1,searchBar.focus(),setAttributes(searchButton,{"aria-hidden":"false","aria-label":"close search area","aria-expanded":"true",role:"search"})):(searchArea.hidden=!0,setAttributes(searchButton,{"aria-hidden":"true","aria-label":"open search area","aria-expanded":"false",role:"search"}))}if(document.onkeydown=function(e){return e.keyCode!==UW.KEYCODES.TAB?e.keyCode!==UW.KEYCODES.ESC||!$("body").hasClass("search-open")||(e.stopPropagation(),toggleSearchArea(),searchButton.focus(),toggleBlur(),!1):(e.target!==submitButton||e.shiftKey||searchLabels.classList.add("focused"),e.target!=submitButton&&searchLabels.classList.contains("focused")&&(searchLabels.classList.remove("focused"),!e.shiftKey)?(e.stopPropagation(),toggleSearchArea(),searchButton.focus(),toggleBlur(),!1):void 0)},searchButton.addEventListener("click",function(){toggleSearchArea(),toggleBlur()}),submitButton.addEventListener("click",function(){Array.from(radiobtn).forEach(function(e){e.disabled=!0}),submitForm()}),"none"==window.getComputedStyle(mobileSelect).display)for(var _loop=function(){var e=radiobtn[i];e.onchange=function(){searchSite=e.value,switchAction()}},i=0;i',initialize:function(t){_.bindAll(this,"toggle","getGroup","toggleCheckBox"),this.settings=_.extend({},this.defaults,this.$el.data(),t),this.$el.after(this.template),this.$input=this.$el,this.name=this.$el.attr("name"),this.setElement(this.$el.closest("label")),this.setState()},setState:function(){this.$input.prop(this.states.disabled)&&this.$el.addClass(this.states.disabled),this.$input.prop(this.states.checked)&&this.$el.addClass(this.states.checked)},getGroup:function(){return"radio"===this.$input.attr("type")?_.where(UW.radio,{name:this.name}):"checkbox"===this.$input.attr("type")?_.where(UW.checkbox,{name:this.name}):void 0},toggle:function(t){_.each(this.getGroup(),this.toggleCheckBox)},toggleCheckBox:function(t){var e=t.$input.prop(this.states.checked),s=t.$input.prop(this.states.disabled);!s&&t.$el.removeClass(this.states.checked)&&t.$el.removeAttr(this.states.checked).trigger("change"),s||(e&&t.$el.addClass(this.states.checked)&&t.$el.trigger($.Event("toggle")),e!==t.$el.prop(this.states.checked)&&t.$el.trigger("change"))}}); \ No newline at end of file diff --git a/style.css b/style.css index 013e2ad..1943290 100755 --- a/style.css +++ b/style.css @@ -5,7 +5,7 @@ GitHub Theme URI: https://github.com/uweb/uw_wp_theme Author: UW Web Strategy Team Author URI: https://github.com/uweb Description: A modern, branded UW theme -Version: 3.0.0 +Version: 3.0.1 License: GNU General Public License v3 or later License URI: LICENSE Text Domain: uw_wp_theme