snoopdave commented on code in PR #348:
URL: https://github.com/apache/roller/pull/348#discussion_r4636772770


##########
app/src/main/webapp/WEB-INF/jsps/tiles/head.jsp:
##########
@@ -26,7 +26,7 @@ You can override it with your own file via 
WEB-INF/tiles-def.xml
 <%-- salt issued with this response, read by refreshSalt() after an AJAX post 
--%>
 <meta name="roller-salt" content="<s:property value="salt"/>" />
 
-<script src="<s:url value='/webjars/jquery/4.0.0/jquery.min.js' />"></script>
+<script src="<s:url value='/webjars/jquery/4.1.0/jquery.min.js' />"></script>

Review Comment:
   **Important:** This jQuery include is admin-only. BasicMobile still calls 
`$("#searchDialog").popup(...)` in `WEB-INF/velocity/weblog.vm`, but its page 
loads neither jQuery nor jQuery Mobile, so empty-search validation throws 
instead of showing the message. The #350 change uses `location.hash = 
"searchDialog"` with CSS already present on `master`; please port that change 
and its regression test.



##########
app/src/main/webapp/themes/gaurav/js/navbar.js:
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// The navbar's collapse button and dropdown menu, using the classes
+// Bootstrap 3's CSS styles, so the theme doesn't need jQuery or Bootstrap's
+// JavaScript.
+(function () {
+    function closeDropdowns(except) {
+        document.querySelectorAll('.dropdown.open').forEach(function 
(dropdown) {
+            if (dropdown !== except) {
+                dropdown.classList.remove('open');
+                var toggle = 
dropdown.querySelector('[data-toggle="dropdown"]');
+                if (toggle) {
+                    toggle.setAttribute('aria-expanded', 'false');
+                }
+            }
+        });
+    }
+
+    document.addEventListener('click', function (event) {
+        var toggle = event.target.closest('[data-toggle]');
+        var kind = toggle ? toggle.getAttribute('data-toggle') : null;
+        if (kind === 'collapse') {
+            var target = 
document.querySelector(toggle.getAttribute('data-target'));
+            if (target) {
+                var shown = target.classList.toggle('in');
+                toggle.classList.toggle('collapsed', !shown);
+                toggle.setAttribute('aria-expanded', String(shown));
+            }
+        } else if (kind === 'dropdown') {
+            event.preventDefault();
+            var dropdown = toggle.parentNode;
+            closeDropdowns(dropdown);
+            var open = dropdown.classList.toggle('open');
+            toggle.setAttribute('aria-expanded', String(open));
+        } else {
+            closeDropdowns(null);
+        }
+    });
+
+    document.addEventListener('keydown', function (event) {

Review Comment:
   **Important:** The previous dropdown handled Arrow Up/Down navigation and 
returned focus to Categories on Escape. This handler only closes the menu, 
leaving focus on a hidden link when Escape is pressed inside it. Add arrow-key 
navigation and restore focus to the toggle when closing from the menu.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to