As the title says succesion. Louis's grandson was promised the title of king of Spain. At Charles's death this was granted in his testament. Louis stood for a crossroad. Either take the over and breaking his deal with William III of Orange or deny it and have as result a France surrounded by enemies. You can't really blame Louis XIV that he took the first option especially since the crown was given to his grandson by right. As we all know the war went dissastrous for France. They were invaded by massive armies of the Dutch, Savoy, Austrians, British and more minor states. You could honoustly say Louis fought for his life and at a certain point he was willing to give up all his conquest he had taken his entire life.
He was saved in the end, but France had took a severe blow. However I disagree that this war lost France it's supremacy. For example French armies achieved glorious victories thirty years kater at the Austrian war of Succesion. France only began to decay after it's decisive defeat at the Seven Years war and only started to recover under the revolution and Napoleon.