Refactor (if feasible) uses of the jQuery slide functions to use vanillaJS

Created on 24 September 2021, almost 3 years ago
Updated 14 June 2024, 11 days ago

Problem/Motivation

As mentioned in the parent issue #3238306: [META] Where possible, refactor existing jQuery uses to vanillaJS to reduce jQuery footprint โ†’ , we are working towards reducing our jQuery footprint. One of the ways to accomplish this is to reduce the number of jQuery features used in Drupal core. We have added eslint rules that identify specific features and fail tests when those features are in use.

There are (or will be) individual issues for each jQuery-use eslint rule. This one is specific to jquery/no-slide, which targets the slide functions: slideDown function, slideUp function, slideToggle function.

Steps to reproduce

Proposed resolution

Remaining tasks

  • In core/.eslintrc.jquery.json Change "jquery/no-slide": 0, to "jquery/no-slide": 2, to enable eslint checks for uses of jQuery .slideDown, slideUp, slideToggle. With this change, you'll be able to see uses of the undesirable jQuery feature by running yarn lint:core-js-passing from the core directory
  • Add the following lines to core/scripts/dev/commit-code-check.sh so the DrupalCI testing script can catch this jQuery usage on all files, not just those which have changed
    # @todo Remove the next chunk of lines before committing. This script only lints
    #  JavaScript files that have changed, so we add this to check all files for
    #  jQuery-specific lint errors.
    cd "$TOP_LEVEL/core"
    node ./node_modules/eslint/bin/eslint.js --quiet --config=.eslintrc.passing.json .
    
    CORRECTJQS=$?
    if [ "$CORRECTJQS" -ne "0" ]; then
      # No need to write any output the node command will do this for us.
      printf "${red}FAILURE ${reset}: unsupported jQuery usage. See errors above."
      STATUS=1
      FINAL_STATUS=1
    fi
    cd $TOP_LEVEL
    # @todo end lines to remove

    Add the block about 10 lines before the end of the file, just before if [[ "$FINAL_STATUS" == "1" ]] && [[ "$DRUPALCI" == "1" ]]; then, then remove it once all the jQuery uses have been refactored.

  • If it's determined to be feasible, refactor those uses of jQuery .slideDown, slideUp, slideToggle to use Vanilla (native) JavaScript instead.

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ“Œ Task
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Javascriptย  โ†’

Last updated about 6 hours ago

  • Maintained by
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom @justafish
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance @nod_
Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States hooroomoo

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ehsann_95
  • Pipeline finished with Success
    4 months ago
    #96477
  • Pipeline finished with Failed
    4 months ago
    Total: 200s
    #96495
  • Pipeline finished with Success
    4 months ago
    Total: 631s
    #96631
  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ehsann_95
  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nod_ Lille

    I'd rather remove the animation altogether. By now we can use CSS to do animation if necessary. Those two places are pretty old things. I don't think the animation adds anything in term of design or usability, especially since our dropbutton does not have an animation and there is one right next to the views +add button.

  • Pipeline finished with Failed
    4 months ago
    Total: 1081s
    #100621
  • Pipeline finished with Failed
    4 months ago
    Total: 172s
    #101135
  • Pipeline finished with Success
    4 months ago
    Total: 551s
    #101141
  • Status changed to Needs review 4 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia ehsann_95
  • Status changed to RTBC 4 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Appears feedback has been addressed.

  • Status changed to Needs work 4 months ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance nod_ Lille

    Still one of your comment left. I'm also wondering what's happening to the progress bar on file uploads.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia shubh511

    shubh_ โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Success
    about 2 months ago
    Total: 527s
    #167258
  • Status changed to Needs review about 2 months ago
  • Status changed to Needs work 11 days ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Looking at the comment // Show the progress bar if the upload takes longer than half a second.

    Sounds like it does serve a purpose so unless we can definitely say it's not needed, don't believe we should remove it.

Production build 0.69.0 2024