function closeMenu(chapterSelected) {
    setComboOpen(false);
    //if chapter not selected set previously selected Book
    if (!chapterSelected) {
      setOpenBookCode(bookCode);
      setSelectedChapterList(prevChapterList);
      bookList.forEach((element, i) => {
        if (element.book_code === bookCode) {
          const lastBook = bookList.length - 1;
          setChapterRow(Math.min(Math.floor(i / 2) * 2 + 1, lastBook));
        }
      });
    }
  }
//function to handle close combo/menu
function to handle close combo/menu
function to handle close combo / menu
function closeMenu(chapterSelected) {
    setComboOpen(false);
    if (!chapterSelected) {
      setOpenBookCode(bookCode);
      setSelectedChapterList(prevChapterList);
      bookList.forEach((element, i) => {
        if (element.book_code === bookCode) {
          const lastBook = bookList.length - 1;
          setChapterRow(Math.min(Math.floor(i / 2) * 2 + 1, lastBook));
        }
      });
    }
  }
function closeMenu ( chapterSelected ) { setComboOpen ( false ) ; if ( ! chapterSelected ) { setOpenBookCode ( bookCode ) ; setSelectedChapterList ( prevChapterList ) ; bookList . forEach ( ( element , i ) => { if ( element . book_code === bookCode ) { const lastBook = bookList . length - 1 ; setChapterRow ( Math . min ( Math . floor ( i / 2 ) * 2 + 1 , lastBook ) ) ; } } ) ; } }
function to handle close combo/menu
function to handle close combo / menu
//if chapter not selected set previously selected Book