Coder Social home page Coder Social logo

ucf / ucf-resource-search-plugin Goto Github PK

View Code? Open in Web Editor NEW
0.0 8.0 0.0 1.16 MB

Plugin for displaying a resource search and list of resources via a shortcode.

PHP 75.71% JavaScript 20.03% SCSS 4.26%
wordpress-plugin wordpress ucf-cm athena-framework

ucf-resource-search-plugin's Issues

Filter nav items end up linking to elements on the page that don't exist

We get flagged in SiteImprove on pages where a resource search is included on the page with nav filters, due to each nav filter link linking out to page anchors that don't actually exist on the page.

Local link destination does not exist
1.3.1 Info and Relationships
Description of this issue:
A local link (anchor link) occurs but the destination does not exist.
How to fix it:
When using local links they must refer to an existing element on the page.

We need to update how these filter links work in a way to resolve the issue above. Maybe using <button>s instead of <a>s for each filter link would be a good place to start?

UCF_Resource_Link_Type::register_meta_fields() doesn't register actions correctly

Warning: call_user_func_array() expects parameter 1 to be a valid callback, class 'UCF_Resource_Link_PostType' does not have a method 'add_resource_link_types_fields' in /wordpress/wp-includes/class-wp-hook.php on line 286

Looks like these actions are getting registered referencing the wrong class name (should be add_action( '...', array( 'UCF_Resource_Link_Type', '...' ) instead of add_action( '...', array( 'UCF_Resource_Link_PostType', '...' ):
https://github.com/UCF/UCF-Resource-Search-Plugin/blob/master/includes/ucf-resource-link-tax.php#L14-L17

Update layout styles for compatibility with Athena v1.1.1+

Description
See title.

Why it's Important
Underlines were added to all links by default in Athena v1.1.1 and can look a bit messy on certain components/layouts.

Alternatives
n/a

Possible Implementation
Remove underlines; test removal of underlines against accessibility scanners

Additional context
See the A-Z index on ucf.edu as an example.

Remove/replace <article> wrapper surrounding both layouts

<article> is probably not the most appropriate tag to surround the resource search + its contents, and it also conflicts with most of our themes that include a single wrapper <article> around page/post content and don't include a unique aria-label for it.

Fix notices

Strict Standards: Non-static method UCF_Resource_Link_PostType::get_labels() should not be called statically in /wordpress/wp-content/plugins/UCF-Resource-Search/includes/ucf-resource-link-posttype.php on line 15

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method UCF_Resource_Search_Common::enqueue_styles() should not be called statically in /wordpress/wp-includes/class-wp-hook.php on line 298

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method UCF_Resource_Search_Common::enqueue_scripts() should not be called statically in /wordpress/wp-includes/class-wp-hook.php on line 298

Plugin stylesheet fails to enqueue when plugin options haven't been updated at least once

public static function enqueue_styles() {
if ( get_option( 'ucf_resource_search_include_css' ) ) {
wp_enqueue_style( 'ucf_resource_search_css', plugins_url( 'static/css/ucf-resource-search.min.css', UCF_Resource_Search__PLUGIN_FILE ), false, false, 'all' );
}
}

Need to enforce an expected default value of true when calling get_option() here; otherwise it'll return empty if the user hasn't force-saved the plugin options at least once.

Move inline resource search init JS to document footer

Description

See title; inline JS used to initialize PostTypeSearchDataManager should be moved to the document footer (currently it's printed in a <script> manually in the "classic" layout)

ob_start();
?>
<script type="text/javascript">
if (typeof jQuery !== 'undefined') {
jQuery(document).ready(function ($) {
PostTypeSearchDataManager.register(new PostTypeSearchData(
<?php echo json_encode( $args['column_count'] ); ?>,
<?php echo json_encode( $args['column_width'] ); ?>,
<?php echo json_encode( $items ); ?>
));
});
} else {
console.log('jQuery dependency failed to load');
}
</script>
<?php
$script = ob_get_clean();

Why it's Important

To allow jQuery to be loaded in the document footer, and better ensure it's available when the resource search JS needs to run.

Alternatives

n/a

Possible Implementation

  1. Use wp_add_inline_script( 'ucf-resource_search_js', $string ) instead of prepending $string to the rest of the layout markup.
  2. Update null to array( 'jquery' ) on the line below to ensure ucf-resource_search_js is registered with jquery as a dependency:

wp_register_script( 'ucf-resource_search_js', UCF_RESOURCE_SEARCH__SCRIPT_URL . '/ucf-resource-search.min.js', null, $version, true );

Additional context

n/a

InfoSec flagged issue

</script> <script type='text/javascript' src='[Site URL Redacted]/wp-content/plugins/UCF-Resource-Search/static/js/ucf-resource-search.min.js'></script> `var t=window.location.hash;t&&-1!==t.indexOf("#filter-")&&("filter-all"===(t=t.replace("#",""))?$resourceLinkCards.show():$resourceLinkCards.show().not("."+t).hide(),isResourceFilterLeft&&scrollToElement($UcfResourceDirectoryItems),setSelected($("."+t)))`

Data is read from window.location.hash and passed to $() via the following statements:

var t=window.location.hash;
$("." + t)

https://cwe.mitre.org/data/definitions/79.html

Search form accessibility improvements

The search form that gets generated for the main resource search feature doesn't include a submit button; we get flagged in Site Improve for every page/instance where this occurs.

We'll need to either:

  • Implement an actual submit button that forces results to be present on submit
  • Or, ensure we're meeting "change of context" requirements as necessary to meet WCAG 2.0 requirements

More info
https://www.w3.org/TR/2016/NOTE-WCAG20-TECHS-20161007/G13
https://www.w3.org/TR/WCAG20-TECHS/H32.html

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.