When the shift key is pressed, the simulation multi-select drop-down box, but how to cancel the default behavior that the text of each option is also selected?

< hr >
   var oShow = document.getElementById("selected"),
                oUl = document.getElementById("list"),
                ev = event || window.event,
                arr = [],
                aLi = oUl.getElementsByTagName("li");

            document.onclick = function () {
                oUl.style.display = "none";
                //
                arr = [];
            }

            oShow.onclick = function (ev) {
                oUl.style.display = "block";
                //documentonclickoUl
                ev.stopPropagation();
            }
            for (let i = 0; i < aLi.length; iPP) {
                aLi[i].onclick = function (ev) {
                    if (ev.shiftKey) {
                        ev.stopPropagation();
                        ev.returnValue=false;
                    }
                     
                    for (let j = 0; j < arr.length; jPP) {
                        if (arr[j] == this.innerHTML) {
                            arr.splice(j, 1);
                            oShow.innerHTML = arr.join(",");
                            setBgColor();
                            return;
                        }

                    }
                    
                    arr.push(this.innerHTML);
                    oShow.innerHTML = arr.join(",");
                    setBgColor();
                }
                //li
                function setBgColor() {
                    for (let j = 0; j < aLi.length; jPP) {
                        aLi[j].className = "";
                    }
                    var arr1 = oShow.innerHTML.split(",");
                    for (let i = 0; i < arr1.length; iPP) {
                        for (let j = 0; j < aLi.length; jPP) {
                            if (arr1[i] == aLi[j].innerHTML) {
                                aLi[j].className = "active";
                            }
                        }
                    }
                }
            }
        }

N methods such as ev.preventDefault (), return fasle can not be used, why? I have been asking for advice and studying it for a long time.

Mar.03,2021

try adding user-select: none;

to CSS.
Menu